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)Creates a new JWT secured authorisation request 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)Creates a new JWT secured authorisation request builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AuthorizationRequestbuild()Builds a new authorisation request.AuthorizationRequest.BuilderclientID(ClientID clientID)Sets the client identifier.AuthorizationRequest.BuildercodeChallenge(CodeChallenge codeChallenge, CodeChallengeMethod codeChallengeMethod)Deprecated.AuthorizationRequest.BuildercodeChallenge(CodeVerifier codeVerifier, CodeChallengeMethod codeChallengeMethod)Sets the code challenge for Proof Key for Code Exchange (PKCE) by public OAuth clients.AuthorizationRequest.BuildercustomParameter(String name, String... values)Sets a custom parameter.AuthorizationRequest.BuilderendpointURI(URI uri)Sets the URI of the endpoint (HTTP or HTTPS) for which the request is intended.AuthorizationRequest.BuilderincludeGrantedScopes(boolean includeGrantedScopes)Requests incremental authorisation.AuthorizationRequest.Builderprompt(Prompt prompt)Sets the requested prompt.AuthorizationRequest.BuilderredirectionURI(URI redirectURI)Sets the redirection URI.AuthorizationRequest.BuilderrequestObject(com.nimbusds.jwt.JWT requestObject)Sets the request object.AuthorizationRequest.BuilderrequestURI(URI requestURI)Sets the request object URI.AuthorizationRequest.Builderresources(URI... resources)Sets the resource server URI(s).AuthorizationRequest.BuilderresponseMode(ResponseMode rm)Sets the response mode.AuthorizationRequest.BuilderresponseType(ResponseType rt)Sets the response type.AuthorizationRequest.Builderscope(Scope scope)Sets the scope.AuthorizationRequest.Builderstate(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_typeparameter. Must not benull.clientID- The client identifier. Corresponds to theclient_idparameter. Must not benull.
-
Builder
public Builder(com.nimbusds.jwt.JWT requestObject)
Creates a new JWT secured authorisation request builder.- Parameters:
requestObject- The request object. Must not benull.
-
Builder
public Builder(URI requestURI)
Creates a new JWT secured authorisation request builder.- Parameters:
requestURI- The request object URI. 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_typeparameter.- Parameters:
rt- The response type. Must not benull.- Returns:
- This builder.
-
clientID
public AuthorizationRequest.Builder clientID(ClientID clientID)
Sets the client identifier. Corresponds to theclient_idparameter.- Parameters:
clientID- The client identifier. Must not benull.- Returns:
- This builder.
-
redirectionURI
public AuthorizationRequest.Builder redirectionURI(URI redirectURI)
Sets the redirection URI. Corresponds to the optionalredirection_uriparameter.- Parameters:
redirectURI- The redirection URI,nullif not specified.- Returns:
- This builder.
-
scope
public AuthorizationRequest.Builder scope(Scope scope)
Sets the scope. Corresponds to the optionalscopeparameter.- Parameters:
scope- The scope,nullif not specified.- Returns:
- This builder.
-
state
public AuthorizationRequest.Builder state(State state)
Sets the state. Corresponds to the recommendedstateparameter.- Parameters:
state- The state,nullif not specified.- Returns:
- This builder.
-
responseMode
public AuthorizationRequest.Builder responseMode(ResponseMode rm)
Sets the response mode. Corresponds to the optionalresponse_modeparameter. Use of this parameter is not recommended unless a non-default response mode is requested (e.g. form_post).- Parameters:
rm- The response mode,nullif 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,nullif not specified.codeChallengeMethod- The code challenge method,nullif 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,nullif PKCE is not specified.codeChallengeMethod- The code challenge method,nullif not specified. Defaults toCodeChallengeMethod.PLAINif 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),nullif not specified.- Returns:
- This builder.
-
includeGrantedScopes
public AuthorizationRequest.Builder includeGrantedScopes(boolean includeGrantedScopes)
Requests incremental authorisation.- Parameters:
includeGrantedScopes-trueto request incremental authorisation.- Returns:
- This builder.
-
requestObject
public AuthorizationRequest.Builder requestObject(com.nimbusds.jwt.JWT requestObject)
Sets the request object. Corresponds to the optionalrequestparameter. Must not be specified together with a request object URI.- Parameters:
requestObject- The request object,nullif not specified.- Returns:
- This builder.
-
requestURI
public AuthorizationRequest.Builder requestURI(URI requestURI)
Sets the request object URI. Corresponds to the optionalrequest_uriparameter. Must not be specified together with a request object.- Parameters:
requestURI- The request object URI,nullif not specified.- Returns:
- This builder.
-
prompt
public AuthorizationRequest.Builder prompt(Prompt prompt)
Sets the requested prompt. Corresponds to the optionalpromptparameter.- Parameters:
prompt- The requested prompt,nullif 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,nullif 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,nullif not specified.- Returns:
- This builder.
-
build
public AuthorizationRequest build()
Builds a new authorisation request.- Returns:
- The authorisation request.
-
-