awesome-gateway-security's People
Forkers
benxiaohai529 royal19790617 tanyujie colinhands salmongit pujianjun 552301 lotreal gitqh chenshufeng atmosphereqq hilin-github longamu mlgis xiejianguo1997 jrhuang-96 tongyp 17639101203 xjieli captainjob sftruelx sdzbzj0406 hujiayi0126 northleafupawesome-gateway-security's Issues
Session Stateless with Webflux Security
spring security 的formLogin认证方式在认证成功后Security会缓存请求浏览器的session信息(WebSessionServerSecurityContextRepository),并将session以set-cookie的方式返回给客户端浏览器,这样浏览器在访问其他接口资源时实际无需再提供认证凭据也可(security会将浏览器发送的cookie和自身的session比较,如果相同,不会再继续认证,即使配置了httpbasic),这样默认Webflux Security 的formLogin认证是通过cookie和session来实现的,有状态的。
不同于HttpSecurity,Webflux Security 并未提供sessionmanagement配置接口使认证无状态。
解决办法:
.and().securityContextRepository(NoOpServerSecurityContextRepository.getInstance())
权威解释:
The security context in a WebFlux application is stored in a ServerSecurityContextRepository. Its WebSessionServerSecurityContextRepository implementation, which is used by default, stores the context in session. Configuring a NoOpServerSecurityContextRepository instead would make our application stateless. To do so, just add the above lines to the SecurityWebFilterChain configuration。
auth/login 404 ?
获取不到表单的username
SecurityUserDetailsService.findByUsername(String username) username==>> "" 获取不到前端传过来的username
如何获取用户信息
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.