public class Auth2DefaultRequestRedirectFilter
extends org.springframework.web.filter.OncePerRequestFilter
Filter initiates the authorization code grant or implicit 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
/auth2/authorization/{registrationId} using the default
Auth2DefaultRequestResolver. The URI template variable
{registrationId} represents the registration identifier of the client that is used for initiating the OAuth 2.0
Authorization Request.
The default base URI /auth2/authorization may be overridden via the
constructor
Auth2DefaultRequestRedirectFilter(String, Auth2StateCoder, TenantContextHolder, SimpleUrlAuthenticationFailureHandler),
or alternatively, an Auth2DefaultRequestResolver may be provided to the
constructor
Auth2DefaultRequestRedirectFilter(Auth2DefaultRequestResolver, Auth2StateCoder, TenantContextHolder, SimpleUrlAuthenticationFailureHandler)}
to override the resolving of authorization requests.
OAuth2AuthorizationRequest,
Auth2DefaultRequestResolver,
AuthorizationRequestRepository,
ClientRegistration,
ClientRegistrationRepository,
Section
4.1 Authorization Code Grant,
Section 4.1.1 Authorization Request
(Authorization Code),
Section
4.2 Implicit Grant,
Section 4.2.1 Authorization Request
(Implicit)| 构造器和说明 |
|---|
Auth2DefaultRequestRedirectFilter(Auth2DefaultRequestResolver authorizationRequestResolver,
Auth2StateCoder auth2StateCoder,
TenantContextHolder tenantContextHolder,
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler authenticationFailureHandler)
Constructs an
Auth2DefaultRequestRedirectFilter using the provided
parameters. |
Auth2DefaultRequestRedirectFilter(String authorizationRequestBaseUri,
Auth2StateCoder auth2StateCoder,
TenantContextHolder tenantContextHolder,
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler authenticationFailureHandler)
Constructs an
Auth2DefaultRequestRedirectFilter using the provided
parameters. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
doFilterInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain filterChain) |
void |
setRequestCache(org.springframework.security.web.savedrequest.RequestCache requestCache)
Sets the
RequestCache used for storing the current request before
redirecting the OAuth 2.0 Authorization Request. |
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatchpublic Auth2DefaultRequestRedirectFilter(@NonNull
String authorizationRequestBaseUri,
@Nullable
Auth2StateCoder auth2StateCoder,
@Nullable
TenantContextHolder tenantContextHolder,
@NonNull
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler authenticationFailureHandler)
Auth2DefaultRequestRedirectFilter using the provided
parameters.authorizationRequestBaseUri - the base URI used for authorization
requestsauth2StateCoder - state 的编解码器tenantContextHolder - 多租户处理器authenticationFailureHandler - 失败处理器public Auth2DefaultRequestRedirectFilter(@NonNull
Auth2DefaultRequestResolver authorizationRequestResolver,
@Nullable
Auth2StateCoder auth2StateCoder,
@Nullable
TenantContextHolder tenantContextHolder,
@NonNull
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler authenticationFailureHandler)
Auth2DefaultRequestRedirectFilter using the provided
parameters.authorizationRequestResolver - the resolver used for resolving authorization
requestsauth2StateCoder - state 的编解码器tenantContextHolder - 多租户处理器authenticationFailureHandler - 失败处理器public final void setRequestCache(org.springframework.security.web.savedrequest.RequestCache requestCache)
RequestCache used for storing the current request before
redirecting the OAuth 2.0 Authorization Request.requestCache - the cache used for storing the current requestprotected void doFilterInternal(@NonNull
javax.servlet.http.HttpServletRequest request,
@NonNull
javax.servlet.http.HttpServletResponse response,
@NonNull
javax.servlet.FilterChain filterChain)
throws javax.servlet.ServletException,
IOException
doFilterInternal 在类中 org.springframework.web.filter.OncePerRequestFilterjavax.servlet.ServletExceptionIOExceptionCopyright © 2021. All rights reserved.