Class IdTokenResponse

java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.json.GenericJson
com.google.api.client.auth.oauth2.TokenResponse
com.google.api.client.auth.openidconnect.IdTokenResponse
All Implemented Interfaces:
Cloneable, Map<String,Object>

@Beta public class IdTokenResponse extends TokenResponse
Beta
OAuth ID Connect JSON model for a successful access token response as specified in OpenID Connect Basic Client Profile 1.0 (draft 23).

Implementation is not thread-safe. Sample usage:

  static JsonWebSignature executeIdToken(TokenRequest tokenRequest) throws IOException {
    IdTokenResponse idTokenResponse = IdTokenResponse.execute(tokenRequest);
    return idTokenResponse.parseIdToken();
  }
 
Since:
1.7
  • Field Details

    • idToken

      private String idToken
      ID token.
  • Constructor Details

    • IdTokenResponse

      public IdTokenResponse()
  • Method Details

    • getIdToken

      public final String getIdToken()
      Returns the ID token.
    • setIdToken

      public IdTokenResponse setIdToken(String idToken)
      Sets the ID token.

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

    • setAccessToken

      public IdTokenResponse setAccessToken(String accessToken)
      Description copied from class: TokenResponse
      Sets the access token issued by the authorization server.

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      Overrides:
      setAccessToken in class TokenResponse
    • setTokenType

      public IdTokenResponse setTokenType(String tokenType)
      Description copied from class: TokenResponse
      Sets the token type (as specified in Access Token Types).

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      Overrides:
      setTokenType in class TokenResponse
    • setExpiresInSeconds

      public IdTokenResponse setExpiresInSeconds(Long expiresIn)
      Description copied from class: TokenResponse
      Sets the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      Overrides:
      setExpiresInSeconds in class TokenResponse
    • setRefreshToken

      public IdTokenResponse setRefreshToken(String refreshToken)
      Description copied from class: TokenResponse
      Sets the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      Overrides:
      setRefreshToken in class TokenResponse
    • setScope

      public IdTokenResponse setScope(String scope)
      Description copied from class: TokenResponse
      Sets the scope of the access token or null for none.

      Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      Overrides:
      setScope in class TokenResponse
    • parseIdToken

      public IdToken parseIdToken() throws IOException
      Parses using JsonWebSignature.parse(JsonFactory, String) based on the JSON factory and ID token.
      Throws:
      IOException
    • execute

      public static IdTokenResponse execute(TokenRequest tokenRequest) throws IOException
      Executes the given ID token request, and returns the parsed ID token response.
      Parameters:
      tokenRequest - token request
      Returns:
      parsed successful ID token response
      Throws:
      TokenResponseException - for an error response
      IOException
    • set

      public IdTokenResponse set(String fieldName, Object value)
      Overrides:
      set in class TokenResponse
    • clone

      public IdTokenResponse clone()
      Overrides:
      clone in class TokenResponse