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.
-
Constructor Summary
ConstructorDescriptionOAuth2AuthorizationRequestRedirectWebFilter
(ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs anOAuth2AuthorizationRequestRedirectFilter
using the provided parameters.OAuth2AuthorizationRequestRedirectWebFilter
(ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver) Constructs anOAuth2AuthorizationRequestRedirectFilter
using 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) void
setAuthorizationRedirectStrategy
(ServerRedirectStrategy authorizationRedirectStrategy) Sets the redirect strategy for Authorization Endpoint redirect URI.final void
setAuthorizationRequestRepository
(ServerAuthorizationRequestRepository<OAuth2AuthorizationRequest> authorizationRequestRepository) Sets the repository used for storingOAuth2AuthorizationRequest
's.void
setRequestCache
(ServerRequestCache requestCache) The request cache to use to save the request before sending a redirect.
-
Constructor Details
-
OAuth2AuthorizationRequestRedirectWebFilter
public OAuth2AuthorizationRequestRedirectWebFilter(ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs anOAuth2AuthorizationRequestRedirectFilter
using the provided parameters.- Parameters:
clientRegistrationRepository
- the repository of client registrations
-
OAuth2AuthorizationRequestRedirectWebFilter
public OAuth2AuthorizationRequestRedirectWebFilter(ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver) Constructs anOAuth2AuthorizationRequestRedirectFilter
using the provided parameters.- Parameters:
authorizationRequestResolver
- the resolver to use
-
-
Method Details
-
setAuthorizationRedirectStrategy
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 storingOAuth2AuthorizationRequest
's.- Parameters:
authorizationRequestRepository
- the repository used for storingOAuth2AuthorizationRequest
's
-
setRequestCache
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 interfaceorg.springframework.web.server.WebFilter
-