We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你这样配置了这个context-path为api,然后白名单里面又设置/api/auth/login放行,但是这个配置不会生效。 springsecurity默认匹配url的时候,不会携带项目名,也就是你的/api。 这里问题很大,我调试了很久才找到问题。不明白你测试的时候怎么会通过的,你登录的时候接口不会报错吗。
The text was updated successfully, but these errors were encountered:
我也是,我默认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()生效了
.anyRequest().permitAll()
Sorry, something went wrong.
我也是,我默认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没发现。
我脑子瓦特了!哈哈哈!已经修改了~感谢两位老哥 @carryxiong @shaohan0228 🤟
No branches or pull requests
你这样配置了这个context-path为api,然后白名单里面又设置/api/auth/login放行,但是这个配置不会生效。
springsecurity默认匹配url的时候,不会携带项目名,也就是你的/api。
这里问题很大,我调试了很久才找到问题。不明白你测试的时候怎么会通过的,你登录的时候接口不会报错吗。
The text was updated successfully, but these errors were encountered: