public class AuthorizationResponse extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AuthorizationResponse.Builder
Creates instances of
AuthorizationResponse . |
Modifier and Type | Field and Description |
---|---|
String |
accessToken
The access token retrieved as part of the authorization flow.
|
Long |
accessTokenExpirationTime
The approximate expiration time of the access token, as milliseconds from the UNIX epoch.
|
Map<String,String> |
additionalParameters
The additional, non-standard parameters in the response.
|
String |
authorizationCode
The authorization code generated by the authorization server.
|
static String |
EXTRA_RESPONSE
The extra string used to store an
AuthorizationResponse in an intent by
toIntent() . |
String |
idToken
The id token retrieved as part of the authorization flow.
|
AuthorizationRequest |
request
The authorization request associated with this response.
|
String |
scope
The scope of the returned access token.
|
String |
state
The returned state parameter, which must match the value specified in the request.
|
static String |
TOKEN_TYPE_BEARER
Indicates that a provided access token is a bearer token.
|
String |
tokenType
The type of the retrieved token.
|
Modifier and Type | Method and Description |
---|---|
TokenRequest |
createTokenExchangeRequest()
Creates a follow-up request to exchange a received authorization code for tokens.
|
TokenRequest |
createTokenExchangeRequest(Map<String,String> additionalExchangeParameters)
Creates a follow-up request to exchange a received authorization code for tokens, including
the provided additional parameters.
|
static AuthorizationResponse |
fromIntent(Intent dataIntent)
Extracts an authorization response from an intent produced by
toIntent() . |
static AuthorizationResponse |
fromJson(JSONObject json)
Reads an authorization response from a JSON object representation produced by
toJson() . |
static AuthorizationResponse |
fromJson(String jsonStr)
Reads an authorization response from a JSON string representation produced by
toJsonString() . |
Set<String> |
getScopeSet()
Derives the set of scopes from the consolidated, space-delimited scopes in the
scope field. |
boolean |
hasAccessTokenExpired()
Determines whether the returned access token has expired.
|
Intent |
toIntent()
Produces an intent containing this authorization response.
|
JSONObject |
toJson()
Converts the response to a JSON object for storage or transmission.
|
String |
toJsonString()
Converts the response to a JSON string for storage or transmission.
|
public static final String EXTRA_RESPONSE
AuthorizationResponse
in an intent by
toIntent()
.public static final String TOKEN_TYPE_BEARER
@NonNull public final AuthorizationRequest request
@Nullable public final String state
@Nullable public final String tokenType
@Nullable public final String authorizationCode
@Nullable public final String accessToken
response_type
of the request included 'token'.@Nullable public final Long accessTokenExpirationTime
response_type
included 'token'.@Nullable public final String idToken
response_type
of the request included 'id_token'.@Nullable public final String scope
public boolean hasAccessTokenExpired()
@Nullable public Set<String> getScopeSet()
scope
field. If no scopes were specified on this response, the method will
return null
.@NonNull public TokenRequest createTokenExchangeRequest()
@NonNull public TokenRequest createTokenExchangeRequest(@NonNull Map<String,String> additionalExchangeParameters)
@NonNull public JSONObject toJson()
@NonNull public String toJsonString()
@NonNull public static AuthorizationResponse fromJson(@NonNull String jsonStr) throws JSONException
toJsonString()
.JSONException
- if the provided JSON does not match the expected structure.@NonNull public static AuthorizationResponse fromJson(@NonNull JSONObject json) throws JSONException
toJson()
.JSONException
- if the provided JSON does not match the expected structure.@NonNull public Intent toIntent()
AuthorizationService.performAuthorizationRequest(net.openid.appauth.AuthorizationRequest, android.app.PendingIntent)
.@Nullable public static AuthorizationResponse fromIntent(@NonNull Intent dataIntent)
toIntent()
. Use
this to extract the response from the intent data passed to an activity registered as the
handler for AuthorizationService.performAuthorizationRequest(net.openid.appauth.AuthorizationRequest, android.app.PendingIntent)
.