Spring Security Webflux学习笔记

2019-11-24  本文已影响0人  无知者云

知识点

DispatcherHandler中的handlerMappings Spring Webflux Security + Spring Cloud Gateway

Spring Security Webflux中的请求处理流程

各个Spring Security Filter依次为:

Filter 作用 相关配置
HttpHeaderWriterWebFilter 向response中加入各种header,比如与安全相关的X-Frame-Options http.headers()
CorsWebFilter CORS相关 http.cors()
CsrfWebFilter CSRF安全配置 http.csrf()
ReactorContextWebFilter 用于根据session等创建SecurityContext http..securityContextRepository()
AuthenticationWebFilter 用于完成认证过程 http.formLogin(),
http.httpBasic(),
http.authenticationManager(),
http.securityContextRepository()
LoginPageGeneratingWebFilter 生成登录页面
LogoutPageGeneratingWebFilter 生成登出之后的页面
SecurityContextServerWebExchangeWebFilter 使ServerWebExchange.getPincipal()返回Authentication对象
ServerRequestCacheWebFilter 缓存request http.requestCache()
LogoutWebFilter 处理登出 http.logout()
ExceptionTranslationWebFilter 用于处理认证或授权失败的情况(主要决定于AuthorizationWebFilter),如果认证失败(即SecurityConext中没有Authentication对象,更确切的说是ServerWebExchange.getPrincipal()返回空),那么将执行ServerAuthenticationEntryPoint,如果授权失败将执行ServerAccessDeniedHandler http.exceptionHandling().authenticationEntryPoint(),
http.exceptionHandling().accessDeniedHandler()
AuthorizationWebFilter 处理授权 http.authorizeExchange().pathMatchers(),
http.authorizeExchange().anyExchange()
上一篇下一篇

猜你喜欢

热点阅读