com.google.api.client.auth.openidconnect
Class IdTokenResponse

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

public class IdTokenResponse
extends TokenResponse

OAuth ID Connect JSON model for a successful access token response as specified in OpenID Connect Session Management 1.0.

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
Author:
Yaniv Inbar

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
IdTokenResponse()
           
 
Method Summary
static IdTokenResponse execute(TokenRequest tokenRequest)
          Executes the given ID token request, and returns the parsed ID token response.
 String getIdToken()
          Returns the ID token.
 JsonWebSignature parseIdToken()
          Parses using JsonWebSignature.parse(JsonFactory, String) based on the JSON factory and ID token.
 IdTokenResponse setAccessToken(String accessToken)
          Sets the access token issued by the authorization server.
 IdTokenResponse setExpiresInSeconds(Long expiresIn)
          Sets the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
 IdTokenResponse setIdToken(String idToken)
          Sets the ID token.
 IdTokenResponse setRefreshToken(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(String scope)
          Sets the scope of the access token or null for none.
 IdTokenResponse setTokenType(String tokenType)
          Sets the token type (as specified in Access Token Types).
 
Methods inherited from class com.google.api.client.auth.oauth2.TokenResponse
getAccessToken, getExpiresInSeconds, getRefreshToken, getScope, getTokenType
 
Methods inherited from class com.google.api.client.json.GenericJson
clone, getFactory, setFactory, toPrettyString, toString
 
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getUnknownKeys, put, putAll, remove, set, 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
 

Constructor Detail

IdTokenResponse

public IdTokenResponse()
Method Detail

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 JsonWebSignature 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


Copyright © 2011-2012 Google. All Rights Reserved.