Class StsTokenExchangeRequest (1.40.0)

publicfinalclass StsTokenExchangeRequest

Represents an OAuth 2.0 token exchange request, as defined in RFC 8693, Section 2.1.

This class encapsulates the parameters necessary for making a token exchange request to Google Security Token Service (STS). It includes the subject token, subject token type, optional parameters like acting party, scopes, resource, audience, requested token type, and internal options.

Instances of this class are immutable. Use the #newBuilder(String, String) method to create a new builder.

Inheritance

java.lang.Object > StsTokenExchangeRequest

Static Methods

newBuilder(String subjectToken, String subjectTokenType)

publicstaticStsTokenExchangeRequest.BuildernewBuilder(StringsubjectToken,StringsubjectTokenType)

Returns a new StsTokenExchangeRequest.Builder instance.

Parameters
Name Description
subjectToken String

The token being exchanged. This represents the credentials being used to authorize the token exchange request.

subjectTokenType String

The type of the subjectToken. For example, OAuth2Utils#TOKEN_TYPE_ACCESS_TOKEN.

Returns
Type Description
StsTokenExchangeRequest.Builder

A new builder for creating StsTokenExchangeRequest instances.

Methods

getActingParty()

publicActingPartygetActingParty()
Returns
Type Description
com.google.auth.oauth2.ActingParty

getAudience()

publicStringgetAudience()
Returns
Type Description
String

getGrantType()

publicStringgetGrantType()
Returns
Type Description
String

getInternalOptions()

publicStringgetInternalOptions()
Returns
Type Description
String

getRequestedTokenType()

publicStringgetRequestedTokenType()
Returns
Type Description
String

getResource()

publicStringgetResource()
Returns
Type Description
String

getScopes()

publicList<String>getScopes()
Returns
Type Description
List<String>

getSubjectToken()

publicStringgetSubjectToken()
Returns
Type Description
String

getSubjectTokenType()

publicStringgetSubjectTokenType()
Returns
Type Description
String

hasActingParty()

publicbooleanhasActingParty()
Returns
Type Description
boolean

hasAudience()

publicbooleanhasAudience()
Returns
Type Description
boolean

hasRequestedTokenType()

publicbooleanhasRequestedTokenType()
Returns
Type Description
boolean

hasResource()

publicbooleanhasResource()
Returns
Type Description
boolean

hasScopes()

publicbooleanhasScopes()
Returns
Type Description
boolean

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.