public class TokenRequest extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TokenRequest.Builder
Creates instances of
TokenRequest . |
Modifier and Type | Field and Description |
---|---|
Map<String,String> |
additionalParameters
Additional parameters to be passed as part of the request.
|
String |
authorizationCode
An authorization code to be exchanged for one or more tokens.
|
String |
clientId
The client identifier.
|
String |
codeVerifier
The code verifier that was used to generate the challenge in the original authorization
request, if one was used.
|
AuthorizationServiceConfiguration |
configuration
The service's
configuration . |
static String |
GRANT_TYPE_AUTHORIZATION_CODE
The grant type used for exchanging an authorization code for one or more tokens.
|
static String |
GRANT_TYPE_CLIENT_CREDENTIALS
The grant type used when requesting an access token using client credentials, typically
TLS client certificates.
|
static String |
GRANT_TYPE_PASSWORD
The grant type used when requesting an access token using a username and password.
|
static String |
GRANT_TYPE_REFRESH_TOKEN
The grant type used when exchanging a refresh token for a new token.
|
String |
grantType
The type of token being sent to the token endpoint.
|
Uri |
redirectUri
The client's redirect URI.
|
String |
refreshToken
A refresh token to be exchanged for a new token.
|
String |
scope
A space-delimited set of scopes used to determine the scope of any returned tokens.
|
Modifier and Type | Method and Description |
---|---|
static TokenRequest |
fromJson(JSONObject json)
Reads a token request from a JSON representation produced by the
toJson() method or some other equivalent producer. |
static TokenRequest |
fromJson(String json)
Reads a token request from a JSON string representation produced by the
toJson() method or some other equivalent producer. |
Set<String> |
getScopeSet()
Derives the set of scopes from the consolidated, space-delimited scopes in the
scope field. |
JSONObject |
toJson()
Converts the token request to JSON for storage or transmission.
|
String |
toJsonString()
Converts the authorization request to a JSON string for storage or transmission.
|
public static final String GRANT_TYPE_AUTHORIZATION_CODE
public static final String GRANT_TYPE_REFRESH_TOKEN
public static final String GRANT_TYPE_PASSWORD
public static final String GRANT_TYPE_CLIENT_CREDENTIALS
@NonNull public final AuthorizationServiceConfiguration configuration
configuration
.
This configuration specifies how to connect to a particular OAuth provider.
Configurations may be
created manually
, or
via an OpenID Connect Discovery Document
.@NonNull public final String grantType
@Nullable public final Uri redirectUri
@Nullable public final String authorizationCode
@Nullable public final String scope
@Nullable public final String refreshToken
@Nullable public final String codeVerifier
@Nullable public Set<String> getScopeSet()
scope
field. If no scopes were specified for this request, the method will
return null
.@NonNull public JSONObject toJson()
@NonNull public String toJsonString()
@NonNull public static TokenRequest fromJson(@NonNull String json) throws JSONException
toJson()
method or some other equivalent producer.JSONException
- if the provided JSON does not match the expected structure.@NonNull public static TokenRequest fromJson(JSONObject json) throws JSONException
toJson()
method or some other equivalent producer.JSONException
- if the provided JSON does not match the expected structure.