Class TokenRequest.Builder
- java.lang.Object
-
- net.openid.appauth.TokenRequest.Builder
-
- Enclosing class:
- TokenRequest
public static final class TokenRequest.Builder extends Object
Creates instances ofTokenRequest.
-
-
Constructor Summary
Constructors Constructor Description Builder(AuthorizationServiceConfiguration configuration, String clientId)Creates a token request builder with the specified mandatory properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenRequestbuild()Produces aTokenRequestinstance, if all necessary values have been provided.TokenRequest.BuildersetAdditionalParameters(Map<String,String> additionalParameters)Specifies an additional set of parameters to be sent as part of the request.TokenRequest.BuildersetAuthorizationCode(String authorizationCode)Specifies the authorization code for the request.TokenRequest.BuildersetClientId(String clientId)Specifies the client ID for the token request, which must not be null or empty.TokenRequest.BuildersetCodeVerifier(String codeVerifier)Specifies the code verifier for an authorization code exchange request.TokenRequest.BuildersetConfiguration(AuthorizationServiceConfiguration configuration)Specifies the authorization service configuration for the request, which must not be null or empty.TokenRequest.BuildersetGrantType(String grantType)Specifies the grant type for the request, which must not be null or empty.TokenRequest.BuildersetNonce(String nonce)Specifies the (optional) nonce for the current session.TokenRequest.BuildersetRedirectUri(Uri redirectUri)Specifies the redirect URI for the request.TokenRequest.BuildersetRefreshToken(String refreshToken)Specifies the refresh token for the request.TokenRequest.BuildersetScope(String scope)Specifies the encoded scope string, which is a space-delimited set of case-sensitive scope identifiers.TokenRequest.BuildersetScopes(Iterable<String> scopes)Specifies the set of case-sensitive scopes.TokenRequest.BuildersetScopes(String... scopes)Specifies the set of case-sensitive scopes.
-
-
-
Constructor Detail
-
Builder
public Builder(@NonNull AuthorizationServiceConfiguration configuration, @NonNull String clientId)
Creates a token request builder with the specified mandatory properties.
-
-
Method Detail
-
setConfiguration
@NonNull public TokenRequest.Builder setConfiguration(@NonNull AuthorizationServiceConfiguration configuration)
Specifies the authorization service configuration for the request, which must not be null or empty.
-
setClientId
@NonNull public TokenRequest.Builder setClientId(@NonNull String clientId)
Specifies the client ID for the token request, which must not be null or empty.
-
setNonce
@NonNull public TokenRequest.Builder setNonce(@Nullable String nonce)
Specifies the (optional) nonce for the current session.
-
setGrantType
@NonNull public TokenRequest.Builder setGrantType(@NonNull String grantType)
Specifies the grant type for the request, which must not be null or empty.
-
setRedirectUri
@NonNull public TokenRequest.Builder setRedirectUri(@Nullable 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.
-
setScope
@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.
- See Also:
“The OAuth 2.0 Authorization Framework (RFC 6749), Section 3.3 https://tools.ietf.org/html/rfc6749#section-3.3”
-
setScopes
@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.
- See Also:
“The OAuth 2.0 Authorization Framework (RFC 6749), Section 3.3 https://tools.ietf.org/html/rfc6749#section-3.3”,“The OAuth 2.0 Authorization Framework (RFC 6749), Section 6 https://tools.ietf.org/html/rfc6749#section-6”
-
setScopes
@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.
- See Also:
“The OAuth 2.0 Authorization Framework (RFC 6749), Section 3.3 https://tools.ietf.org/html/rfc6749#section-3.3”,“The OAuth 2.0 Authorization Framework (RFC 6749), Section 6 https://tools.ietf.org/html/rfc6749#section-6”
-
setAuthorizationCode
@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.
-
setRefreshToken
@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.
-
setCodeVerifier
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.
-
setAdditionalParameters
@NonNull public TokenRequest.Builder setAdditionalParameters(@Nullable Map<String,String> additionalParameters)
Specifies an additional set of parameters to be sent as part of the request.
-
build
@NonNull public TokenRequest build()
Produces aTokenRequestinstance, if all necessary values have been provided.
-
-