Package com.nimbusds.openid.connect.sdk
Class AuthenticationRequest.Builder
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.AuthenticationRequest.Builder
-
- Enclosing class:
- AuthenticationRequest
public static class AuthenticationRequest.Builder extends Object
Builder for constructing OpenID Connect authentication requests.
-
-
Constructor Summary
Constructors Constructor Description Builder(com.nimbusds.jwt.JWT requestObject)Creates a new JWT secured OpenID Connect authentication request builder.Builder(ResponseType rt, Scope scope, ClientID clientID, URI redirectURI)Creates a new OpenID Connect authentication request builder.Builder(AuthenticationRequest request)Creates a new OpenID Connect authentication request builder from the specified request.Builder(URI requestURI)Creates a new JWT secured OpenID Connect authentication request builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AuthenticationRequest.BuilderacrValues(List<ACR> acrValues)Sets the requested Authentication Context Class Reference values.AuthenticationRequestbuild()Builds a new authentication request.AuthenticationRequest.Builderclaims(ClaimsRequest claims)Sets the individual claims to be returned.AuthenticationRequest.BuilderclaimsLocales(List<com.nimbusds.langtag.LangTag> claimsLocales)Sets the end-user's preferred languages and scripts for the claims being returned, ordered by preference.AuthenticationRequest.BuilderclientID(ClientID clientID)Sets the client identifier.AuthenticationRequest.BuildercodeChallenge(CodeChallenge codeChallenge, CodeChallengeMethod codeChallengeMethod)Deprecated.AuthenticationRequest.BuildercodeChallenge(CodeVerifier codeVerifier, CodeChallengeMethod codeChallengeMethod)Sets the code challenge for Proof Key for Code Exchange (PKCE) by public OAuth clients.AuthenticationRequest.BuildercustomParameter(String name, String... values)Sets a custom parameter.AuthenticationRequest.Builderdisplay(Display display)Sets the requested display type.AuthenticationRequest.BuilderendpointURI(URI uri)Sets the URI of the endpoint (HTTP or HTTPS) for which the request is intended.AuthenticationRequest.BuilderidTokenHint(com.nimbusds.jwt.JWT idTokenHint)Sets the ID Token hint.AuthenticationRequest.BuilderincludeGrantedScopes(boolean includeGrantedScopes)Requests incremental authorisation.AuthenticationRequest.BuilderloginHint(String loginHint)Sets the login hint.AuthenticationRequest.BuildermaxAge(int maxAge)Sets the required maximum authentication age.AuthenticationRequest.Buildernonce(Nonce nonce)Sets the nonce.AuthenticationRequest.Builderprompt(Prompt prompt)Sets the requested prompt.AuthenticationRequest.Builderpurpose(String purpose)Sets the transaction specific purpose.AuthenticationRequest.BuilderredirectionURI(URI redirectURI)Sets the redirection URI.AuthenticationRequest.BuilderrequestObject(com.nimbusds.jwt.JWT requestObject)Sets the request object.AuthenticationRequest.BuilderrequestURI(URI requestURI)Sets the request object URI.AuthenticationRequest.Builderresources(URI... resources)Sets the resource server URI(s).AuthenticationRequest.BuilderresponseMode(ResponseMode rm)Sets the response mode.AuthenticationRequest.BuilderresponseType(ResponseType rt)Sets the response type.AuthenticationRequest.Builderscope(Scope scope)Sets the scope.AuthenticationRequest.Builderstate(State state)Sets the state.AuthenticationRequest.BuilderuiLocales(List<com.nimbusds.langtag.LangTag> uiLocales)Sets the end-user's preferred languages and scripts for the user interface, ordered by preference.
-
-
-
Constructor Detail
-
Builder
public Builder(ResponseType rt, Scope scope, ClientID clientID, URI redirectURI)
Creates a new OpenID Connect authentication request builder.- Parameters:
rt- The response type. Corresponds to theresponse_typeparameter. Must specify a valid OpenID Connect response type. Must not benull.scope- The request scope. Corresponds to thescopeparameter. Must contain anopenid value. Must not benull.clientID- The client identifier. Corresponds to theclient_idparameter. Must not benull.redirectURI- The redirection URI. Corresponds to theredirect_uriparameter. Must not benullunless set by means of the optionalrequest_object/request_uriparameter.
-
Builder
public Builder(com.nimbusds.jwt.JWT requestObject)
Creates a new JWT secured OpenID Connect authentication request builder.- Parameters:
requestObject- The request object. Must not benull.
-
Builder
public Builder(URI requestURI)
Creates a new JWT secured OpenID Connect authentication request builder.- Parameters:
requestURI- The request object URI. Must not benull.
-
Builder
public Builder(AuthenticationRequest request)
Creates a new OpenID Connect authentication request builder from the specified request.- Parameters:
request- The OpenID Connect authentication request. Must not benull.
-
-
Method Detail
-
responseType
public AuthenticationRequest.Builder responseType(ResponseType rt)
Sets the response type. Corresponds to theresponse_typeparameter.- Parameters:
rt- The response type. Must not benull.- Returns:
- This builder.
-
scope
public AuthenticationRequest.Builder scope(Scope scope)
Sets the scope. Corresponds to thescopeparameter.- Parameters:
scope- The scope. Must not benull.- Returns:
- This builder.
-
clientID
public AuthenticationRequest.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 AuthenticationRequest.Builder redirectionURI(URI redirectURI)
Sets the redirection URI. Corresponds to theredirection_uriparameter.- Parameters:
redirectURI- The redirection URI. Must not benull.- Returns:
- This builder.
-
state
public AuthenticationRequest.Builder state(State state)
Sets the state. Corresponds to the recommendedstateparameter.- Parameters:
state- The state,nullif not specified.- Returns:
- This builder.
-
endpointURI
public AuthenticationRequest.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.
-
nonce
public AuthenticationRequest.Builder nonce(Nonce nonce)
Sets the nonce. Corresponds to the conditionally optionalnonceparameter.- Parameters:
nonce- The nonce,nullif not specified.- Returns:
- This builder.
-
display
public AuthenticationRequest.Builder display(Display display)
Sets the requested display type. Corresponds to the optionaldisplayparameter.- Parameters:
display- The requested display type,nullif not specified.- Returns:
- This builder.
-
prompt
public AuthenticationRequest.Builder prompt(Prompt prompt)
Sets the requested prompt. Corresponds to the optionalpromptparameter.- Parameters:
prompt- The requested prompt,nullif not specified.- Returns:
- This builder.
-
maxAge
public AuthenticationRequest.Builder maxAge(int maxAge)
Sets the required maximum authentication age. Corresponds to the optionalmax_ageparameter.- Parameters:
maxAge- The maximum authentication age, in seconds; 0 if not specified.- Returns:
- This builder.
-
uiLocales
public AuthenticationRequest.Builder uiLocales(List<com.nimbusds.langtag.LangTag> uiLocales)
Sets the end-user's preferred languages and scripts for the user interface, ordered by preference. Corresponds to the optionalui_localesparameter.- Parameters:
uiLocales- The preferred UI locales,nullif not specified.- Returns:
- This builder.
-
claimsLocales
public AuthenticationRequest.Builder claimsLocales(List<com.nimbusds.langtag.LangTag> claimsLocales)
Sets the end-user's preferred languages and scripts for the claims being returned, ordered by preference. Corresponds to the optionalclaims_localesparameter.- Parameters:
claimsLocales- The preferred claims locales,nullif not specified.- Returns:
- This builder.
-
idTokenHint
public AuthenticationRequest.Builder idTokenHint(com.nimbusds.jwt.JWT idTokenHint)
Sets the ID Token hint. Corresponds to the conditionally optionalid_token_hintparameter.- Parameters:
idTokenHint- The ID Token hint,nullif not specified.- Returns:
- This builder.
-
loginHint
public AuthenticationRequest.Builder loginHint(String loginHint)
Sets the login hint. Corresponds to the optionallogin_hintparameter.- Parameters:
loginHint- The login hint,nullif not specified.- Returns:
- This builder.
-
acrValues
public AuthenticationRequest.Builder acrValues(List<ACR> acrValues)
Sets the requested Authentication Context Class Reference values. Corresponds to the optionalacr_valuesparameter.- Parameters:
acrValues- The requested ACR values,nullif not specified.- Returns:
- This builder.
-
claims
public AuthenticationRequest.Builder claims(ClaimsRequest claims)
Sets the individual claims to be returned. Corresponds to the optionalclaimsparameter.- Parameters:
claims- The individual claims to be returned,nullif not specified.- Returns:
- This builder.
-
purpose
public AuthenticationRequest.Builder purpose(String purpose)
Sets the transaction specific purpose. Corresponds to the optionalpurposeparameter.- Parameters:
purpose- The purpose,nullif not specified.- Returns:
- This builder.
-
requestObject
public AuthenticationRequest.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 AuthenticationRequest.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.
-
responseMode
public AuthenticationRequest.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 AuthenticationRequest.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 AuthenticationRequest.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 AuthenticationRequest.Builder resources(URI... resources)
Sets the resource server URI(s).- Parameters:
resources- The resource URI(s),nullif not specified.- Returns:
- This builder.
-
includeGrantedScopes
public AuthenticationRequest.Builder includeGrantedScopes(boolean includeGrantedScopes)
Requests incremental authorisation.- Parameters:
includeGrantedScopes-trueto request incremental authorisation.- Returns:
- This builder.
-
customParameter
public AuthenticationRequest.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.
-
build
public AuthenticationRequest build()
Builds a new authentication request.- Returns:
- The authentication request.
-
-