spring-boot - 为什么我的 spring 安全配置不起作用?
问题描述
如果我使用浏览器导航到 /toQuestion 的 url,它将成功打开。
但是,通过使用 js 代码:
window.location.href = "/toQuestion";
我将被重定向回 /chief 的登录页面,我是这样配置的:
http.authorizeRequests(
authorizeRequests -> authorizeRequests
.mvcMatchers(
"/js/**",
"/css/**",
"/chief",
"/toQuestion").permitAll()
.anyRequest().authenticated()
)
.formLogin(
form -> form
.loginPage("/chief")
.permitAll()
)
我已向任何未经身份验证的用户授予“/toQuestion”权限。我需要设置任何其他配置吗?
解决方案
OK.我解决了。在我更改包org.springframework.security的级别调试细节后,我意识到我没有实现AuthenticationProvider的supports方法来指示这个AuthenticationProvider支持哪个Authentication Object。
推荐阅读
- sql - 安排 Sybase IQ SQL 代码每天运行
- javascript - 正则表达式递归
- sql - WHERE 子句中的 CASE 或 IF 语句
- arrays - 如何将数组从子组件传递给父组件角度8
- windows - Chr (169) 未给出版权符号
- flutter - Flutter 1.12 应用程序在 iPhone 4S (iOS 9.3.6) 设备上崩溃
- android - 如何在我的颤振应用程序中获取欧元符号或印度货币符号?
- html - 是否可以使用可选的页眉或页脚行动态数量的 CSS Grid 列
- java - 在 gradle 脚本中通过 AntBuilder 提供主类属性
- python - 如何在熊猫的行中插入某个值