Class DefaultOAuth2AuthorizationRequestResolver

java.lang.Object
org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizationRequestResolver
All Implemented Interfaces:
OAuth2AuthorizationRequestResolver

public final class DefaultOAuth2AuthorizationRequestResolver extends Object implements OAuth2AuthorizationRequestResolver
An implementation of an OAuth2AuthorizationRequestResolver that attempts to resolve an OAuth2AuthorizationRequest from the provided HttpServletRequest using the default request URI pattern /oauth2/authorization/{registrationId}.

NOTE: The default base URI /oauth2/authorization may be overridden via its constructor DefaultOAuth2AuthorizationRequestResolver(ClientRegistrationRepository, String).

Since:
5.1
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultOAuth2AuthorizationRequestResolver(ClientRegistrationRepository clientRegistrationRepository, String authorizationRequestBaseUri)
    Constructs a DefaultOAuth2AuthorizationRequestResolver using the provided parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest
    resolve(jakarta.servlet.http.HttpServletRequest request)
    Returns the OAuth2AuthorizationRequest resolved from the provided HttpServletRequest or null if not available.
    org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest
    resolve(jakarta.servlet.http.HttpServletRequest request, String registrationId)
    Returns the OAuth2AuthorizationRequest resolved from the provided HttpServletRequest or null if not available.
    void
    setAuthorizationRequestCustomizer(Consumer<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer)
    Sets the Consumer to be provided the OAuth2AuthorizationRequest.Builder allowing for further customizations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultOAuth2AuthorizationRequestResolver

      public DefaultOAuth2AuthorizationRequestResolver(ClientRegistrationRepository clientRegistrationRepository, String authorizationRequestBaseUri)
      Constructs a DefaultOAuth2AuthorizationRequestResolver using the provided parameters.
      Parameters:
      clientRegistrationRepository - the repository of client registrations
      authorizationRequestBaseUri - the base URI used for resolving authorization requests
  • Method Details

    • resolve

      public org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest resolve(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: OAuth2AuthorizationRequestResolver
      Returns the OAuth2AuthorizationRequest resolved from the provided HttpServletRequest or null if not available.
      Specified by:
      resolve in interface OAuth2AuthorizationRequestResolver
      Parameters:
      request - the HttpServletRequest
      Returns:
      the resolved OAuth2AuthorizationRequest or null if not available
    • resolve

      public org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest resolve(jakarta.servlet.http.HttpServletRequest request, String registrationId)
      Description copied from interface: OAuth2AuthorizationRequestResolver
      Returns the OAuth2AuthorizationRequest resolved from the provided HttpServletRequest or null if not available.
      Specified by:
      resolve in interface OAuth2AuthorizationRequestResolver
      Parameters:
      request - the HttpServletRequest
      registrationId - the clientRegistrationId to use
      Returns:
      the resolved OAuth2AuthorizationRequest or null if not available
    • setAuthorizationRequestCustomizer

      public void setAuthorizationRequestCustomizer(Consumer<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer)
      Sets the Consumer to be provided the OAuth2AuthorizationRequest.Builder allowing for further customizations.
      Parameters:
      authorizationRequestCustomizer - the Consumer to be provided the OAuth2AuthorizationRequest.Builder
      Since:
      5.3
      See Also: