public static final class AuthorizationRequest.Builder extends Object
Creates instances of AuthorizationRequest
.
Constructor and Description |
---|
Builder(AuthorizationServiceConfiguration configuration,
String clientId,
String responseType,
android.net.Uri redirectUri)
Creates an authorization request builder with the specified mandatory properties.
|
Modifier and Type | Method and Description |
---|---|
AuthorizationRequest |
build()
Constructs the authorization request.
|
AuthorizationRequest.Builder |
setAdditionalParameters(Map<String,String> additionalParameters)
Specifies additional parameters.
|
AuthorizationRequest.Builder |
setAuthorizationServiceConfiguration(AuthorizationServiceConfiguration configuration)
Specifies the service configuration to be used in dispatching this request.
|
AuthorizationRequest.Builder |
setClientId(String clientId)
Specifies the client ID.
|
AuthorizationRequest.Builder |
setCodeVerifier(String codeVerifier)
Specifies the code verifier to use for this authorization request.
|
AuthorizationRequest.Builder |
setCodeVerifier(String codeVerifier,
String codeVerifierChallenge,
String codeVerifierChallengeMethod)
Specifies the code verifier, challenge and method strings to use for this authorization
request.
|
AuthorizationRequest.Builder |
setDisplay(String display)
Specifies the OpenID Connect 1.0
display parameter. |
AuthorizationRequest.Builder |
setLoginHint(String loginHint)
Specifies the OpenID Connect 1.0
login_hint parameter. |
AuthorizationRequest.Builder |
setPrompt(String prompt)
Specifies the encoded OpenID Connect 1.0
prompt parameter, which is a
space-delimited set of case sensitive ASCII prompt values. |
AuthorizationRequest.Builder |
setPromptValues(Iterable<String> promptValues)
Specifies the set of OpenID Connect 1.0
prompt parameter values, which are
space-delimited, case sensitive ASCII prompt values. |
AuthorizationRequest.Builder |
setPromptValues(String... promptValues)
Specifies the set of OpenID Connect 1.0
prompt parameter values, which are
space-delimited, case sensitive ASCII prompt values. |
AuthorizationRequest.Builder |
setRedirectUri(android.net.Uri redirectUri)
Specifies the client’s redirect URI.
|
AuthorizationRequest.Builder |
setResponseMode(String responseMode)
Specifies the response mode to be used for returning authorization response parameters
from the authorization endpoint.
|
AuthorizationRequest.Builder |
setResponseType(String responseType)
Specifies the expected response type.
|
AuthorizationRequest.Builder |
setScope(String scope)
Specifies the encoded scope string, which is a space-delimited set of
case-sensitive scope identifiers.
|
AuthorizationRequest.Builder |
setScopes(Iterable<String> scopes)
Specifies the set of case-sensitive scopes.
|
AuthorizationRequest.Builder |
setScopes(String... scopes)
Specifies the set of case-sensitive scopes.
|
AuthorizationRequest.Builder |
setState(String state)
Specifies the opaque value used by the client to maintain state between the request and
callback.
|
public Builder(@NonNull AuthorizationServiceConfiguration configuration, @NonNull String clientId, @NonNull String responseType, @NonNull android.net.Uri redirectUri)
Creates an authorization request builder with the specified mandatory properties.
public AuthorizationRequest.Builder setAuthorizationServiceConfiguration(@NonNull AuthorizationServiceConfiguration configuration)
Specifies the service configuration to be used in dispatching this request.
@NonNull public AuthorizationRequest.Builder setClientId(@NonNull String clientId)
Specifies the client ID. Cannot be null or empty.
public AuthorizationRequest.Builder setDisplay(@Nullable String display)
Specifies the OpenID Connect 1.0 display
parameter.
public AuthorizationRequest.Builder setLoginHint(@Nullable String loginHint)
Specifies the OpenID Connect 1.0 login_hint
parameter.
@NonNull public AuthorizationRequest.Builder setPrompt(@Nullable String prompt)
Specifies the encoded OpenID Connect 1.0 prompt
parameter, which is a
space-delimited set of case sensitive ASCII prompt values. Replaces any previously
specified prompt values.
@NonNull public AuthorizationRequest.Builder setPromptValues(@Nullable String... promptValues)
Specifies the set of OpenID Connect 1.0 prompt
parameter values, which are
space-delimited, case sensitive ASCII prompt values. Replaces any previously
specified prompt values.
@NonNull public AuthorizationRequest.Builder setPromptValues(@Nullable Iterable<String> promptValues)
Specifies the set of OpenID Connect 1.0 prompt
parameter values, which are
space-delimited, case sensitive ASCII prompt values. Replaces any previously
specified prompt values.
@NonNull public AuthorizationRequest.Builder setResponseType(@NonNull String responseType)
Specifies the expected response type. Cannot be null or empty.
@NonNull public AuthorizationRequest.Builder setRedirectUri(@NonNull android.net.Uri redirectUri)
Specifies the client’s redirect URI. Cannot be null or empty.
@NonNull public AuthorizationRequest.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 AuthorizationRequest.Builder setScopes(String... scopes)
Specifies the set of case-sensitive scopes. Replaces any previously specified set of
scopes. If no arguments are provided, the scope string will be set to null
.
Individual scope strings cannot be null or empty.
@NonNull public AuthorizationRequest.Builder setScopes(@Nullable Iterable<String> scopes)
Specifies the set of case-sensitive scopes. Replaces any previously specified set of
scopes. If the iterable is empty, the scope string will be set to null
.
Individual scope strings cannot be null or empty.
@NonNull public AuthorizationRequest.Builder setState(@Nullable String state)
Specifies the opaque value used by the client to maintain state between the request and callback. If this value is not explicitly set, this library will automatically add state and perform appropriate validation of the state in the authorization response. It is recommended that the default implementation of this parameter be used wherever possible. Typically used to prevent CSRF attacks, as recommended in RFC6819 Section 5.3.5.
@NonNull public AuthorizationRequest.Builder setCodeVerifier(@Nullable String codeVerifier)
Specifies the code verifier to use for this authorization request. The default challenge
method (typically AuthorizationRequest.CODE_CHALLENGE_METHOD_S256
) implemented by
CodeVerifierUtil
will be used, and a challenge will be generated using this
method. If the use of a code verifier is not desired, set the code verifier
to null
.
@NonNull public AuthorizationRequest.Builder setCodeVerifier(@Nullable String codeVerifier, @Nullable String codeVerifierChallenge, @Nullable String codeVerifierChallengeMethod)
Specifies the code verifier, challenge and method strings to use for this authorization request. If these values are not explicitly set, they will be automatically generated and used. It is recommended that this default behavior be used wherever possible. If a null code verifier is set (to indicate that a code verifier is not to be used), then the challenge and method must also be null. If a non-null code verifier is set, the code verifier challenge and method must also be set.
@NonNull public AuthorizationRequest.Builder setResponseMode(@Nullable String responseMode)
Specifies the response mode to be used for returning authorization response parameters from the authorization endpoint.
@NonNull public AuthorizationRequest.Builder setAdditionalParameters(@Nullable Map<String,String> additionalParameters)
Specifies additional parameters. Replaces any previously provided set of parameters. Parameter keys and values cannot be null or empty.
@NonNull public AuthorizationRequest build()
Constructs the authorization request. At a minimum the following fields must have been set:
Failure to specify any of these parameters will result in a runtime exception.