public static final class TokenResponse.Builder
extends java.lang.Object
Creates instances of TokenResponse.
| Constructor and Description |
|---|
Builder(TokenRequest request)
Creates a token response associated with the specified request.
|
| Modifier and Type | Method and Description |
|---|---|
TokenResponse |
build()
Creates the token response instance.
|
TokenResponse.Builder |
fromResponseJson(org.json.JSONObject json)
Extracts token response fields from a JSON object.
|
TokenResponse.Builder |
fromResponseJsonString(java.lang.String jsonStr)
Extracts token response fields from a JSON string.
|
TokenResponse.Builder |
setAccessToken(java.lang.String accessToken)
Specifies the access token.
|
TokenResponse.Builder |
setAccessTokenExpirationTime(java.lang.Long expiresAt)
Sets the exact expiration time of the access token, in milliseconds since the UNIX epoch.
|
TokenResponse.Builder |
setAccessTokenExpiresIn(java.lang.Long expiresIn)
Sets the relative expiration time of the access token, in seconds, using the default
system clock as the source of the current time.
|
TokenResponse.Builder |
setAdditionalParameters(java.util.Map<java.lang.String,java.lang.String> additionalParameters)
Specifies the additional, non-standard parameters received as part of the response.
|
TokenResponse.Builder |
setIdToken(java.lang.String idToken)
Specifies the ID token.
|
TokenResponse.Builder |
setRefreshToken(java.lang.String refreshToken)
Specifies the refresh token.
|
TokenResponse.Builder |
setRequest(TokenRequest request)
Specifies the request associated with this response.
|
TokenResponse.Builder |
setScope(java.lang.String scope)
Specifies the encoded scope string, which is a space-delimited set of
case-sensitive scope identifiers.
|
TokenResponse.Builder |
setScopes(java.lang.Iterable<java.lang.String> scopes)
Specifies the set of case-sensitive scopes.
|
TokenResponse.Builder |
setScopes(java.lang.String... scopes)
Specifies the set of case-sensitive scopes.
|
TokenResponse.Builder |
setTokenType(java.lang.String tokenType)
Specifies the token type of the access token in this response.
|
public Builder(@NonNull
TokenRequest request)
Creates a token response associated with the specified request.
@NonNull public TokenResponse.Builder fromResponseJsonString(@NonNull java.lang.String jsonStr) throws org.json.JSONException
Extracts token response fields from a JSON string.
org.json.JSONException - if the JSON is malformed or has incorrect value types for fields.@NonNull public TokenResponse.Builder fromResponseJson(@NonNull org.json.JSONObject json) throws org.json.JSONException
Extracts token response fields from a JSON object.
org.json.JSONException - if the JSON is malformed or has incorrect value types for fields.@NonNull public TokenResponse.Builder setRequest(@NonNull TokenRequest request)
Specifies the request associated with this response. Must not be null.
@NonNull public TokenResponse.Builder setTokenType(@Nullable java.lang.String tokenType)
Specifies the token type of the access token in this response. If not null, the value must be non-empty.
@NonNull public TokenResponse.Builder setAccessToken(@Nullable java.lang.String accessToken)
Specifies the access token. If not null, the value must be non-empty.
@NonNull public TokenResponse.Builder setAccessTokenExpiresIn(@NonNull java.lang.Long expiresIn)
Sets the relative expiration time of the access token, in seconds, using the default system clock as the source of the current time.
@NonNull public TokenResponse.Builder setAccessTokenExpirationTime(@Nullable java.lang.Long expiresAt)
Sets the exact expiration time of the access token, in milliseconds since the UNIX epoch.
public TokenResponse.Builder setIdToken(@Nullable java.lang.String idToken)
Specifies the ID token. If not null, the value must be non-empty.
public TokenResponse.Builder setRefreshToken(@Nullable java.lang.String refreshToken)
Specifies the refresh token. If not null, the value must be non-empty.
@NonNull public TokenResponse.Builder setScope(@Nullable java.lang.String scope)
Specifies the encoded scope string, which is a space-delimited set of case-sensitive scope identifiers. Replaces any previously specified scope.
@NonNull public TokenResponse.Builder setScopes(java.lang.String... scopes)
Specifies the set of case-sensitive scopes. Replaces any previously specified set of scopes. Individual scope strings cannot be null or empty.
Scopes specified here are used to obtain a "down-scoped" access token, where the set of scopes specified _must_ be a subset of those already granted in previous requests.
@NonNull public TokenResponse.Builder setScopes(@Nullable java.lang.Iterable<java.lang.String> scopes)
Specifies the set of case-sensitive scopes. Replaces any previously specified set of scopes. Individual scope strings cannot be null or empty.
Scopes specified here are used to obtain a "down-scoped" access token, where the set of scopes specified _must_ be a subset of those already granted in previous requests.
@NonNull public TokenResponse.Builder setAdditionalParameters(@Nullable java.util.Map<java.lang.String,java.lang.String> additionalParameters)
Specifies the additional, non-standard parameters received as part of the response.
public TokenResponse build()
Creates the token response instance.