Class OAuth2AuthorizationRequestRedirectWebFilter

java.lang.Object
org.springframework.security.oauth2.client.web.server.OAuth2AuthorizationRequestRedirectWebFilter
All Implemented Interfaces:
org.springframework.web.server.WebFilter

public class OAuth2AuthorizationRequestRedirectWebFilter extends Object implements org.springframework.web.server.WebFilter
This WebFilter initiates the authorization code grant flow by redirecting the End-User's user-agent to the Authorization Server's Authorization Endpoint.

It builds the OAuth 2.0 Authorization Request, which is used as the redirect URI to the Authorization Endpoint. The redirect URI will include the client identifier, requested scope(s), state, response type, and a redirection URI which the authorization server will send the user-agent back to once access is granted (or denied) by the End-User (Resource Owner).

By default, this Filter responds to authorization requests at the URI /oauth2/authorization/{registrationId}. The URI template variable {registrationId} represents the registration identifier of the client that is used for initiating the OAuth 2.0 Authorization Request.

Since:
5.1
See Also:
  • Constructor Details

    • OAuth2AuthorizationRequestRedirectWebFilter

      public OAuth2AuthorizationRequestRedirectWebFilter(ReactiveClientRegistrationRepository clientRegistrationRepository)
      Constructs an OAuth2AuthorizationRequestRedirectFilter using the provided parameters.
      Parameters:
      clientRegistrationRepository - the repository of client registrations
    • OAuth2AuthorizationRequestRedirectWebFilter

      public OAuth2AuthorizationRequestRedirectWebFilter(ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver)
      Constructs an OAuth2AuthorizationRequestRedirectFilter using the provided parameters.
      Parameters:
      authorizationRequestResolver - the resolver to use
  • Method Details

    • setAuthorizationRedirectStrategy

      public void setAuthorizationRedirectStrategy(ServerRedirectStrategy authorizationRedirectStrategy)
      Sets the redirect strategy for Authorization Endpoint redirect URI.
      Parameters:
      authorizationRedirectStrategy - the redirect strategy
    • setAuthorizationRequestRepository

      public final void setAuthorizationRequestRepository(ServerAuthorizationRequestRepository<OAuth2AuthorizationRequest> authorizationRequestRepository)
      Sets the repository used for storing OAuth2AuthorizationRequest's.
      Parameters:
      authorizationRequestRepository - the repository used for storing OAuth2AuthorizationRequest's
    • setRequestCache

      public void setRequestCache(ServerRequestCache requestCache)
      The request cache to use to save the request before sending a redirect.
      Parameters:
      requestCache - the cache to redirect to.
    • filter

      public reactor.core.publisher.Mono<Void> filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)
      Specified by:
      filter in interface org.springframework.web.server.WebFilter