Class IdTokenResponse

  • All Implemented Interfaces:
    java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.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
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.api.client.util.GenericData

        com.google.api.client.util.GenericData.Flags
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String idToken
      ID token.
    • Constructor Summary

      Constructors 
      Constructor Description
      IdTokenResponse()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IdTokenResponse clone()  
      static IdTokenResponse execute​(TokenRequest tokenRequest)
      Executes the given ID token request, and returns the parsed ID token response.
      java.lang.String getIdToken()
      Returns the ID token.
      IdToken parseIdToken()
      Parses using JsonWebSignature.parse(JsonFactory, String) based on the JSON factory and ID token.
      IdTokenResponse set​(java.lang.String fieldName, java.lang.Object value)  
      IdTokenResponse setAccessToken​(java.lang.String accessToken)
      Sets the access token issued by the authorization server.
      IdTokenResponse setExpiresInSeconds​(java.lang.Long expiresIn)
      Sets the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      IdTokenResponse setIdToken​(java.lang.String idToken)
      Sets the ID token.
      IdTokenResponse setRefreshToken​(java.lang.String refreshToken)
      Sets the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.
      IdTokenResponse setScope​(java.lang.String scope)
      Sets the scope of the access token or null for none.
      IdTokenResponse setTokenType​(java.lang.String tokenType)
      Sets the token type (as specified in Access Token Types).
      • Methods inherited from class com.google.api.client.json.GenericJson

        getFactory, setFactory, toPrettyString, toString
      • Methods inherited from class com.google.api.client.util.GenericData

        entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
      • Methods inherited from class java.util.AbstractMap

        clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • idToken

        private java.lang.String idToken
        ID token.
    • Constructor Detail

      • IdTokenResponse

        public IdTokenResponse()
    • Method Detail

      • getIdToken

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

        public IdTokenResponse setIdToken​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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 java.io.IOException
        Parses using JsonWebSignature.parse(JsonFactory, String) based on the JSON factory and ID token.
        Throws:
        java.io.IOException
      • execute

        public static IdTokenResponse execute​(TokenRequest tokenRequest)
                                       throws java.io.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
        java.io.IOException