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 Summary
ConstructorsConstructorDescriptionOAuth2AuthorizationRequestRedirectWebFilter(ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs anOAuth2AuthorizationRequestRedirectFilterusing the provided parameters.OAuth2AuthorizationRequestRedirectWebFilter(ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver) Constructs anOAuth2AuthorizationRequestRedirectFilterusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain) voidsetAuthorizationRedirectStrategy(org.springframework.security.web.server.ServerRedirectStrategy authorizationRedirectStrategy) Sets the redirect strategy for Authorization Endpoint redirect URI.final voidsetAuthorizationRequestRepository(ServerAuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest> authorizationRequestRepository) Sets the repository used for storingOAuth2AuthorizationRequest's.voidsetRequestCache(org.springframework.security.web.server.savedrequest.ServerRequestCache requestCache) The request cache to use to save the request before sending a redirect.
-
Constructor Details
-
OAuth2AuthorizationRequestRedirectWebFilter
public OAuth2AuthorizationRequestRedirectWebFilter(ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs anOAuth2AuthorizationRequestRedirectFilterusing the provided parameters.- Parameters:
clientRegistrationRepository- the repository of client registrations
-
OAuth2AuthorizationRequestRedirectWebFilter
public OAuth2AuthorizationRequestRedirectWebFilter(ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver) Constructs anOAuth2AuthorizationRequestRedirectFilterusing the provided parameters.- Parameters:
authorizationRequestResolver- the resolver to use
-
-
Method Details
-
setAuthorizationRedirectStrategy
public void setAuthorizationRedirectStrategy(org.springframework.security.web.server.ServerRedirectStrategy authorizationRedirectStrategy) Sets the redirect strategy for Authorization Endpoint redirect URI.- Parameters:
authorizationRedirectStrategy- the redirect strategy
-
setAuthorizationRequestRepository
public final void setAuthorizationRequestRepository(ServerAuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest> authorizationRequestRepository) Sets the repository used for storingOAuth2AuthorizationRequest's.- Parameters:
authorizationRequestRepository- the repository used for storingOAuth2AuthorizationRequest's
-
setRequestCache
public void setRequestCache(org.springframework.security.web.server.savedrequest.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:
filterin interfaceorg.springframework.web.server.WebFilter
-