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 Details

    • Builder

      public Builder(ResponseType rt, ClientID clientID)
      Creates a new authorisation request builder.
      Parameters:
      rt - The response type. Corresponds to the response_type parameter. Must not be null.
      clientID - The client identifier. Corresponds to the client_id parameter. Must not be null.
    • 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 be null.
      clientID - The client ID. Must not be null.
    • Builder

      public Builder(URI requestURI, ClientID clientID)
      Creates a new JWT secured authorisation request (JAR) builder.
      Parameters:
      requestURI - The request object URI. Must not be null.
      clientID - The client ID. Must not be null.
    • Builder

      public Builder(AuthorizationRequest request)
      Creates a new authorisation request builder from the specified request.
      Parameters:
      request - The authorisation request. Must not be null.
  • Method Details

    • responseType

      Sets the response type. Corresponds to the response_type parameter.
      Parameters:
      rt - The response type. Must not be null.
      Returns:
      This builder.
    • redirectionURI

      Sets the redirection URI. Corresponds to the optional redirection_uri parameter.
      Parameters:
      redirectURI - The redirection URI, null if not specified.
      Returns:
      This builder.
    • scope

      Sets the scope. Corresponds to the optional scope parameter.
      Parameters:
      scope - The scope, null if not specified.
      Returns:
      This builder.
    • state

      Sets the state. Corresponds to the recommended state parameter.
      Parameters:
      state - The state, null if not specified.
      Returns:
      This builder.
    • responseMode

      Sets the response mode. Corresponds to the optional response_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.
      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 to CodeChallengeMethod.PLAIN if a code verifier is specified.
      Returns:
      This builder.
    • authorizationDetails

      Sets the Rich Authorisation Request (RAR) details.
      Parameters:
      authorizationDetails - The authorisation details, null if not specified.
      Returns:
      This builder.
    • resource

      Sets the resource server URI.
      Parameters:
      resource - The resource URI, null if not specified.
      Returns:
      This builder.
    • 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 optional request parameter. Must not be specified together with a request object URI.
      Parameters:
      requestObject - The request object, null if not specified.
      Returns:
      This builder.
    • requestURI

      Sets the request object URI. Corresponds to the optional request_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

      Sets the requested prompt. Corresponds to the optional prompt parameter.
      Parameters:
      prompt - The requested prompt, null if not specified.
      Returns:
      This builder.
    • prompt

      Sets the requested prompt. Corresponds to the optional prompt parameter.
      Parameters:
      promptType - The requested prompt types, null if not specified.
      Returns:
      This builder.
    • dPoPJWKThumbprintConfirmation

      Sets the DPoP JWK SHA-256 thumbprint. Corresponds to the optional dpop_jkt parameter.
      Parameters:
      dpopJKT - DPoP JWK SHA-256 thumbprint, null if not specified.
      Returns:
      This builder.
    • trustChain

      Sets the OpenID Connect Federation 1.0 trust chain. Corresponds to the optional trust_chain parameter.
      Parameters:
      trustChain - The trust chain, null if not specified.
      Returns:
      This builder.
    • customParameter

      Sets a custom parameter.
      Parameters:
      name - The parameter name. Must not be null.
      values - The parameter values, null if not specified.
      Returns:
      This builder.
    • endpointURI

      Sets the URI of the authorisation endpoint.
      Parameters:
      endpoint - The URI of the authorisation endpoint. May be null if the request is not going to be serialised.
      Returns:
      This builder.
    • build

      Builds a new authorisation request.
      Returns:
      The authorisation request.