我想知道如何在spring security中重定向访问被拒绝的页面? 我应该使用某种处理程序还是在 web.xml 中进行编辑?
谢谢
最佳答案
您是否阅读了 Spring Security 手册的相关部分,即 AccessDeniedHandler和 namespace appendix .
如果你想要更多的控制,你可以使用
<http use-expressions="true">
<intercept-url pattern="/denied/*" access="permitAll" />
<access-denied-handler error-page="/denied">
<!-- The rest of your configuration -->
</http>
其中 /denied
映射到您编写的 Web Controller 类。确保 /denied/**
不 protected 。
如果这不能回答您的问题,能否请您更详细地解释您要实现的目标?
关于java - 如何在 spring security 中重定向访问被拒绝的页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8875141/