public static final class TokenRequest.Builder extends Object
Creates instances of TokenRequest.
| Constructor and Description |
|---|
Builder(AuthorizationServiceConfiguration configuration,
String clientId)
Creates a token request builder with the specified mandatory properties.
|
| Modifier and Type | Method and Description |
|---|---|
TokenRequest |
build()
Produces a
TokenRequest instance, if all necessary values have been provided. |
TokenRequest.Builder |
setAdditionalParameters(Map<String,String> additionalParameters)
Specifies an additional set of parameters to be sent as part of the request.
|
TokenRequest.Builder |
setAuthorizationCode(String authorizationCode)
Specifies the authorization code for the request.
|
TokenRequest.Builder |
setClientId(String clientId)
Specifies the client ID for the token request, which must not be null or empty.
|
TokenRequest.Builder |
setCodeVerifier(String codeVerifier)
Specifies the code verifier for an authorization code exchange request.
|
TokenRequest.Builder |
setConfiguration(AuthorizationServiceConfiguration configuration)
Specifies the authorization service configuration for the request, which must not
be null or empty.
|
TokenRequest.Builder |
setGrantType(String grantType)
Specifies the grant type for the request, which must not be null or empty.
|
TokenRequest.Builder |
setRedirectUri(android.net.Uri redirectUri)
Specifies the redirect URI for the request.
|
TokenRequest.Builder |
setRefreshToken(String refreshToken)
Specifies the refresh token for the request.
|
TokenRequest.Builder |
setScope(String scope)
Specifies the encoded scope string, which is a space-delimited set of
case-sensitive scope identifiers.
|
TokenRequest.Builder |
setScopes(Iterable<String> scopes)
Specifies the set of case-sensitive scopes.
|
TokenRequest.Builder |
setScopes(String... scopes)
Specifies the set of case-sensitive scopes.
|
public Builder(@NonNull
AuthorizationServiceConfiguration configuration,
@NonNull
String clientId)
Creates a token request builder with the specified mandatory properties.
@NonNull public TokenRequest.Builder setConfiguration(@NonNull AuthorizationServiceConfiguration configuration)
Specifies the authorization service configuration for the request, which must not be null or empty.
@NonNull public TokenRequest.Builder setClientId(@NonNull String clientId)
Specifies the client ID for the token request, which must not be null or empty.
@NonNull public TokenRequest.Builder setGrantType(@NonNull String grantType)
Specifies the grant type for the request, which must not be null or empty.
@NonNull public TokenRequest.Builder setRedirectUri(@Nullable android.net.Uri redirectUri)
Specifies the redirect URI for the request. This is required for authorization code exchanges, but otherwise optional. If specified, the redirect URI must have a scheme.
@NonNull public TokenRequest.Builder setScope(@Nullable 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 TokenRequest.Builder setScopes(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 TokenRequest.Builder setScopes(@Nullable Iterable<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 TokenRequest.Builder setAuthorizationCode(@Nullable String authorizationCode)
Specifies the authorization code for the request. If provided, the authorization code must not be empty.
Specifying an authorization code normally implies that this is a request to exchange this authorization code for one or more tokens. If this is not intended, the grant type should be explicitly set.
@NonNull public TokenRequest.Builder setRefreshToken(@Nullable String refreshToken)
Specifies the refresh token for the request. If a non-null value is provided, it must not be empty.
Specifying a refresh token normally implies that this is a request to exchange the refresh token for a new token. If this is not intended, the grant type should be explicit set.
public TokenRequest.Builder setCodeVerifier(@Nullable String codeVerifier)
Specifies the code verifier for an authorization code exchange request. This must match the code verifier that was used to generate the challenge sent in the request that produced the authorization code.
@NonNull public TokenRequest.Builder setAdditionalParameters(@Nullable Map<String,String> additionalParameters)
Specifies an additional set of parameters to be sent as part of the request.
@NonNull public TokenRequest build()
Produces a TokenRequest instance, if all necessary values have been provided.