默认错误处理不返回正确的信息;我将SpringBoot版本从2.5.2升级到2.6.2案例场景:发送get方法而不进行身份验证:
邮递员对springBoot 2.6.2:springBoot版本2.6.2的回复
邮递员对springBoot 2.5.2:springBoot版本2.5.2的回复
缺乏返回内容是一种有意的行动吗?我将使用@ControllerAdvice来解析这个isue。
项目详情:
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>发布于 2022-01-17 00:19:29
此问题是由ErrorPageSecurityFilter附带的新筛选器Spring 2.6.2引起的。这里你可以找到一个尝试过相同问题的不同情况的人。
在另一个与ErrorPageSecurityFilter相关的问题上,有人说:
WebInvocationPrivilegeEvaluator.isAllowed(uri,身份验证方法( ErrorPageSecurityFilter )使用HttpServletRequest.getRequestURI()作为uri参数,该方法包含上下文路径。JavaDoc注意到在uri参数中应该排除上下文路径。
我认为这是因为在uri参数中没有像在description 这里中那样排除这里。
也许看看这里的建议会对你有帮助。
https://stackoverflow.com/questions/70623849
复制相似问题