java.lang.Object
org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationEndpointConfigurer

public final class OAuth2AuthorizationEndpointConfigurer extends Object
Configurer for the OAuth 2.0 Authorization Endpoint.
Since:
7.0
See Also:
  • Method Details

    • authorizationRequestConverter

      public OAuth2AuthorizationEndpointConfigurer authorizationRequestConverter(org.springframework.security.web.authentication.AuthenticationConverter authorizationRequestConverter)
      Adds an AuthenticationConverter used when attempting to extract an Authorization Request (or Consent) from HttpServletRequest to an instance of OAuth2AuthorizationCodeRequestAuthenticationToken or OAuth2AuthorizationConsentAuthenticationToken used for authenticating the request.
      Parameters:
      authorizationRequestConverter - an AuthenticationConverter used when attempting to extract an Authorization Request (or Consent) from HttpServletRequest
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • authorizationRequestConverters

      public OAuth2AuthorizationEndpointConfigurer authorizationRequestConverters(Consumer<List<org.springframework.security.web.authentication.AuthenticationConverter>> authorizationRequestConvertersConsumer)
      Sets the Consumer providing access to the List of default and (optionally) added AuthenticationConverter's allowing the ability to add, remove, or customize a specific AuthenticationConverter.
      Parameters:
      authorizationRequestConvertersConsumer - the Consumer providing access to the List of default and (optionally) added AuthenticationConverter's
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • authenticationProvider

      public OAuth2AuthorizationEndpointConfigurer authenticationProvider(org.springframework.security.authentication.AuthenticationProvider authenticationProvider)
      Adds an AuthenticationProvider used for authenticating an OAuth2AuthorizationCodeRequestAuthenticationToken.
      Parameters:
      authenticationProvider - an AuthenticationProvider used for authenticating an OAuth2AuthorizationCodeRequestAuthenticationToken
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • authenticationProviders

      public OAuth2AuthorizationEndpointConfigurer authenticationProviders(Consumer<List<org.springframework.security.authentication.AuthenticationProvider>> authenticationProvidersConsumer)
      Sets the Consumer providing access to the List of default and (optionally) added AuthenticationProvider's allowing the ability to add, remove, or customize a specific AuthenticationProvider.
      Parameters:
      authenticationProvidersConsumer - the Consumer providing access to the List of default and (optionally) added AuthenticationProvider's
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • authorizationResponseHandler

      public OAuth2AuthorizationEndpointConfigurer authorizationResponseHandler(org.springframework.security.web.authentication.AuthenticationSuccessHandler authorizationResponseHandler)
      Sets the AuthenticationSuccessHandler used for handling an OAuth2AuthorizationCodeRequestAuthenticationToken and returning the Authorization Response.
      Parameters:
      authorizationResponseHandler - the AuthenticationSuccessHandler used for handling an OAuth2AuthorizationCodeRequestAuthenticationToken
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • errorResponseHandler

      public OAuth2AuthorizationEndpointConfigurer errorResponseHandler(org.springframework.security.web.authentication.AuthenticationFailureHandler errorResponseHandler)
      Sets the AuthenticationFailureHandler used for handling an OAuth2AuthorizationCodeRequestAuthenticationException and returning the Error Response.
      Parameters:
      errorResponseHandler - the AuthenticationFailureHandler used for handling an OAuth2AuthorizationCodeRequestAuthenticationException
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • consentPage

      public OAuth2AuthorizationEndpointConfigurer consentPage(String consentPage)
      Specify the URI to redirect Resource Owners to if consent is required during the authorization_code flow. A default consent page will be generated when this attribute is not specified. If a URI is specified, applications are required to process the specified URI to generate a consent page. The query string will contain the following parameters:
      • client_id - the client identifier
      • scope - a space-delimited list of scopes present in the authorization request
      • state - a CSRF protection token
      In general, the consent page should create a form that submits a request with the following requirements:
      • It must be an HTTP POST
      • It must be submitted to AuthorizationServerSettings.getAuthorizationEndpoint()
      • It must include the received client_id as an HTTP parameter
      • It must include the received state as an HTTP parameter
      • It must include the list of scopes the Resource Owner consented to as an HTTP parameter
      Parameters:
      consentPage - the URI of the custom consent page to redirect to if consent is required (e.g. "/oauth2/consent")
      Returns:
      the OAuth2AuthorizationEndpointConfigurer for further configuration
    • postProcess

      protected final <T> T postProcess(T object)
    • getObjectPostProcessor

      protected final ObjectPostProcessor<Object> getObjectPostProcessor()