Comments (3)
我也是,我默认context-path为/时,无法达到同样的效果
结果发现spring security做匹配的时候,是不会携带context-path做匹配的
// 登录接口
.antMatchers(HttpMethod.POST, SecurityConstants.LOGIN_WHITELIST).permitAll()
// 指定路径下的资源需要验证了的用户才能访问
.antMatchers(SecurityConstants.FILTER_ALL).authenticated()
.antMatchers(HttpMethod.DELETE, SecurityConstants.FILTER_ALL).hasRole("ADMIN")
// 其他都放行了
.anyRequest().permitAll()
这一段,实际上只有.anyRequest().permitAll()
生效了
from spring-security-jwt-guide.
我也是,我默认context-path为/时,无法达到同样的效果
结果发现spring security做匹配的时候,是不会携带context-path做匹配的// 登录接口 .antMatchers(HttpMethod.POST, SecurityConstants.LOGIN_WHITELIST).permitAll() // 指定路径下的资源需要验证了的用户才能访问 .antMatchers(SecurityConstants.FILTER_ALL).authenticated() .antMatchers(HttpMethod.DELETE, SecurityConstants.FILTER_ALL).hasRole("ADMIN") // 其他都放行了 .anyRequest().permitAll()这一段,实际上只有
.anyRequest().permitAll()
生效了
是的,统统失败了,这个还是我调试了很久,找到匹配源码才发现/api并没有参与匹配,所以这个demo问题很大,就觉得作者调试的时候为啥这么严重的bug没发现。
from spring-security-jwt-guide.
我脑子瓦特了!哈哈哈!已经修改了~感谢两位老哥 @carryxiong @shaohan0228 🤟
from spring-security-jwt-guide.
Related Issues (20)
- 认证服务器、资源服务器、客户端
- 怎么里面的类,跟示例的不一样? HOT 1
- 为啥没有看到 auth/login 这个路由定义在哪个控制器了呢? HOT 1
- "/auth/register"未定义解决
- 登录URL的问题 HOT 1
- User实体里的updateFrom方法未给密码加密导致更新后以明文存储密码 HOT 1
- 说明文档请修改一下 HOT 2
- 前端访问产生cors问题 HOT 2
- 循环依赖 HOT 1
- 按照你的方式自行搭建了一下无任何响应 HOT 1
- token合法性问题 HOT 2
- JWT_SECRET_KEY 生成的问题
- 项目中不存在UsernamePasswordAuthenticationFilter这个过滤器
- 对于登录方面有一些疑问 HOT 3
- 你好!提供优化建议!
- jwt是否适合作为后台登录的token
- SpringSecurity介绍.md文件问题
- post调试工具 HOT 1
- 创建数据库表的SQL语句在哪呢?
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.
from spring-security-jwt-guide.