Class IdTokenResponse
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.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:
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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringidTokenID token.
-
Constructor Summary
Constructors Constructor Description IdTokenResponse()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IdTokenResponseclone()static IdTokenResponseexecute(TokenRequest tokenRequest)Executes the given ID token request, and returns the parsed ID token response.java.lang.StringgetIdToken()Returns the ID token.IdTokenparseIdToken()IdTokenResponseset(java.lang.String fieldName, java.lang.Object value)IdTokenResponsesetAccessToken(java.lang.String accessToken)Sets the access token issued by the authorization server.IdTokenResponsesetExpiresInSeconds(java.lang.Long expiresIn)Sets the lifetime in seconds of the access token (for example 3600 for an hour) ornullfor none.IdTokenResponsesetIdToken(java.lang.String idToken)Sets the ID token.IdTokenResponsesetRefreshToken(java.lang.String refreshToken)Sets the refresh token which can be used to obtain new access tokens using the same authorization grant ornullfor none.IdTokenResponsesetScope(java.lang.String scope)Sets the scope of the access token ornullfor none.IdTokenResponsesetTokenType(java.lang.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
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
-
-
-
-
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:TokenResponseSets 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:
setAccessTokenin classTokenResponse
-
setTokenType
public IdTokenResponse setTokenType(java.lang.String tokenType)
Description copied from class:TokenResponseSets 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:
setTokenTypein classTokenResponse
-
setExpiresInSeconds
public IdTokenResponse setExpiresInSeconds(java.lang.Long expiresIn)
Description copied from class:TokenResponseSets the lifetime in seconds of the access token (for example 3600 for an hour) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setExpiresInSecondsin classTokenResponse
-
setRefreshToken
public IdTokenResponse setRefreshToken(java.lang.String refreshToken)
Description copied from class:TokenResponseSets the refresh token which can be used to obtain new access tokens using the same authorization grant ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setRefreshTokenin classTokenResponse
-
setScope
public IdTokenResponse setScope(java.lang.String scope)
Description copied from class:TokenResponseSets the scope of the access token ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setScopein classTokenResponse
-
parseIdToken
public IdToken parseIdToken() throws java.io.IOException
- 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 responsejava.io.IOException
-
set
public IdTokenResponse set(java.lang.String fieldName, java.lang.Object value)
- Overrides:
setin classTokenResponse
-
clone
public IdTokenResponse clone()
- Overrides:
clonein classTokenResponse
-
-