Package com.nimbusds.oauth2.sdk
Class AuthorizationRequest.Builder
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.AuthorizationRequest.Builder
-
- Enclosing class:
- AuthorizationRequest
public static class AuthorizationRequest.Builder extends Object
Builder for constructing authorisation requests.
-
-
Constructor Summary
Constructors Constructor Description Builder(com.nimbusds.jwt.JWT requestObject, ClientID clientID)
Creates a new JWT secured authorisation request (JAR) builder.Builder(AuthorizationRequest request)
Creates a new authorisation request builder from the specified request.Builder(ResponseType rt, ClientID clientID)
Creates a new authorisation request builder.Builder(URI requestURI, ClientID clientID)
Creates a new JWT secured authorisation request (JAR) builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AuthorizationRequest
build()
Builds a new authorisation request.AuthorizationRequest.Builder
codeChallenge(CodeChallenge codeChallenge, CodeChallengeMethod codeChallengeMethod)
Deprecated.AuthorizationRequest.Builder
codeChallenge(CodeVerifier codeVerifier, CodeChallengeMethod codeChallengeMethod)
Sets the code challenge for Proof Key for Code Exchange (PKCE) by public OAuth clients.AuthorizationRequest.Builder
customParameter(String name, String... values)
Sets a custom parameter.AuthorizationRequest.Builder
endpointURI(URI uri)
Sets the URI of the endpoint (HTTP or HTTPS) for which the request is intended.AuthorizationRequest.Builder
includeGrantedScopes(boolean includeGrantedScopes)
Requests incremental authorisation.AuthorizationRequest.Builder
prompt(Prompt prompt)
Sets the requested prompt.AuthorizationRequest.Builder
redirectionURI(URI redirectURI)
Sets the redirection URI.AuthorizationRequest.Builder
requestObject(com.nimbusds.jwt.JWT requestObject)
Sets the request object.AuthorizationRequest.Builder
requestURI(URI requestURI)
Sets the request object URI.AuthorizationRequest.Builder
resources(URI... resources)
Sets the resource server URI(s).AuthorizationRequest.Builder
responseMode(ResponseMode rm)
Sets the response mode.AuthorizationRequest.Builder
responseType(ResponseType rt)
Sets the response type.AuthorizationRequest.Builder
scope(Scope scope)
Sets the scope.AuthorizationRequest.Builder
state(State state)
Sets the state.
-
-
-
Constructor Detail
-
Builder
public Builder(ResponseType rt, ClientID clientID)
Creates a new authorisation request builder.- Parameters:
rt
- The response type. Corresponds to theresponse_type
parameter. Must not benull
.clientID
- The client identifier. Corresponds to theclient_id
parameter. Must not benull
.
-
Builder
public Builder(com.nimbusds.jwt.JWT requestObject, ClientID clientID)
Creates a new JWT secured authorisation request (JAR) builder.- Parameters:
requestObject
- The request object. Must not benull
.'clientID
- The client ID. Must not benull
.
-
Builder
public Builder(URI requestURI, ClientID clientID)
Creates a new JWT secured authorisation request (JAR) builder.- Parameters:
requestURI
- The request object URI. Must not benull
.clientID
- The client ID. Must not benull
.
-
Builder
public Builder(AuthorizationRequest request)
Creates a new authorisation request builder from the specified request.- Parameters:
request
- The authorisation request. Must not benull
.
-
-
Method Detail
-
responseType
public AuthorizationRequest.Builder responseType(ResponseType rt)
Sets the response type. Corresponds to theresponse_type
parameter.- Parameters:
rt
- The response type. Must not benull
.- Returns:
- This builder.
-
redirectionURI
public AuthorizationRequest.Builder redirectionURI(URI redirectURI)
Sets the redirection URI. Corresponds to the optionalredirection_uri
parameter.- Parameters:
redirectURI
- The redirection URI,null
if not specified.- Returns:
- This builder.
-
scope
public AuthorizationRequest.Builder scope(Scope scope)
Sets the scope. Corresponds to the optionalscope
parameter.- Parameters:
scope
- The scope,null
if not specified.- Returns:
- This builder.
-
state
public AuthorizationRequest.Builder state(State state)
Sets the state. Corresponds to the recommendedstate
parameter.- Parameters:
state
- The state,null
if not specified.- Returns:
- This builder.
-
responseMode
public AuthorizationRequest.Builder responseMode(ResponseMode rm)
Sets the response mode. Corresponds to the optionalresponse_mode
parameter. Use of this parameter is not recommended unless a non-default response mode is requested (e.g. form_post).- Parameters:
rm
- The response mode,null
if not specified.- Returns:
- This builder.
-
codeChallenge
@Deprecated public AuthorizationRequest.Builder codeChallenge(CodeChallenge codeChallenge, CodeChallengeMethod codeChallengeMethod)
Deprecated.Sets the code challenge for Proof Key for Code Exchange (PKCE) by public OAuth clients.- Parameters:
codeChallenge
- The code challenge,null
if not specified.codeChallengeMethod
- The code challenge method,null
if not specified.- Returns:
- This builder.
-
codeChallenge
public AuthorizationRequest.Builder codeChallenge(CodeVerifier codeVerifier, CodeChallengeMethod codeChallengeMethod)
Sets the code challenge for Proof Key for Code Exchange (PKCE) by public OAuth clients.- Parameters:
codeVerifier
- The code verifier to use to compute the code challenge,null
if PKCE is not specified.codeChallengeMethod
- The code challenge method,null
if not specified. Defaults toCodeChallengeMethod.PLAIN
if a code verifier is specified.- Returns:
- This builder.
-
resources
public AuthorizationRequest.Builder resources(URI... resources)
Sets the resource server URI(s).- Parameters:
resources
- The resource URI(s),null
if not specified.- Returns:
- This builder.
-
includeGrantedScopes
public AuthorizationRequest.Builder includeGrantedScopes(boolean includeGrantedScopes)
Requests incremental authorisation.- Parameters:
includeGrantedScopes
-true
to request incremental authorisation.- Returns:
- This builder.
-
requestObject
public AuthorizationRequest.Builder requestObject(com.nimbusds.jwt.JWT requestObject)
Sets the request object. Corresponds to the optionalrequest
parameter. Must not be specified together with a request object URI.- Parameters:
requestObject
- The request object,null
if not specified.- Returns:
- This builder.
-
requestURI
public AuthorizationRequest.Builder requestURI(URI requestURI)
Sets the request object URI. Corresponds to the optionalrequest_uri
parameter. Must not be specified together with a request object.- Parameters:
requestURI
- The request object URI,null
if not specified.- Returns:
- This builder.
-
prompt
public AuthorizationRequest.Builder prompt(Prompt prompt)
Sets the requested prompt. Corresponds to the optionalprompt
parameter.- Parameters:
prompt
- The requested prompt,null
if not specified.- Returns:
- This builder.
-
customParameter
public AuthorizationRequest.Builder customParameter(String name, String... values)
Sets a custom parameter.- Parameters:
name
- The parameter name. Must not benull
.values
- The parameter values,null
if not specified.- Returns:
- This builder.
-
endpointURI
public AuthorizationRequest.Builder endpointURI(URI uri)
Sets the URI of the endpoint (HTTP or HTTPS) for which the request is intended.- Parameters:
uri
- The endpoint URI,null
if not specified.- Returns:
- This builder.
-
build
public AuthorizationRequest build()
Builds a new authorisation request.- Returns:
- The authorisation request.
-
-