Class StsTokenExchangeRequest

java.lang.Object
com.google.auth.oauth2.StsTokenExchangeRequest

public final class StsTokenExchangeRequest extends Object
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.

  • Method Details

    • newBuilder

      public static StsTokenExchangeRequest.Builder newBuilder(String subjectToken, String subjectTokenType)
      Returns a new StsTokenExchangeRequest.Builder instance.
      Parameters:
      subjectToken - The token being exchanged. This represents the credentials being used to authorize the token exchange request.
      subjectTokenType - The type of the subjectToken. For example, OAuth2Utils.TOKEN_TYPE_ACCESS_TOKEN.
      Returns:
      A new builder for creating StsTokenExchangeRequest instances.
    • getGrantType

      public String getGrantType()
    • getSubjectToken

      public String getSubjectToken()
    • getSubjectTokenType

      public String getSubjectTokenType()
    • getResource

      @Nullable public String getResource()
    • getAudience

      @Nullable public String getAudience()
    • getRequestedTokenType

      @Nullable public String getRequestedTokenType()
    • getScopes

      @Nullable public List<String> getScopes()
    • getActingParty

      @Nullable public com.google.auth.oauth2.ActingParty getActingParty()
    • getInternalOptions

      @Nullable public String getInternalOptions()
    • hasResource

      public boolean hasResource()
    • hasAudience

      public boolean hasAudience()
    • hasRequestedTokenType

      public boolean hasRequestedTokenType()
    • hasScopes

      public boolean hasScopes()
    • hasActingParty

      public boolean hasActingParty()