Giter Club home page Giter Club logo

awesome-gateway-security's People

Contributors

darrenjiang1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

awesome-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。

获取不到表单的username

SecurityUserDetailsService.findByUsername(String username) username==>> "" 获取不到前端传过来的username

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.