大佬教程收集整理的这篇文章主要介绍了spring – 使用方法级安全性处理AccessDenied,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@PreAuthorize("hasRole('add_user')")
public void addUser(User user) ;
如果没有enoguh权限的用户试图调用它
,抛出accessDenied异常:
org.springframework.security.access.AccessDeniedException: Access is denied
这是预期的,但问题是,为什么定义的访问被拒绝处理程序
我的意思是没有工作,当用户没有足够的权限尝试按下按钮addUser将调用服务addUser(只有用户可以访问具有此权限)时,抛出AccessDenied异常,这是所需的行为,但用户不是不会重定向到xml中配置的访问被拒绝异常.
当抛出此异常时,用户是否应该自动重定向到访问被拒绝的页面,或者我必须在@L_489_17@中明确定义此类行为?
请指教.
我使用Spring Security 3.0.5与JSF 2.1和ICEFaces 2
更新:applicationSecurity.xml:
http://www.springframework.org/scheR_119_11845@a/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/scheR_119_11845@a/security
http://www.springframework.org/scheR_119_11845@a/security/spring-security-3.0.4.xsd
http://www.springframework.org/scheR_119_11845@a/util
http://www.springframework.org/scheR_119_11845@a/util/spring-util-3.1.xsd">
以上是大佬教程为你收集整理的spring – 使用方法级安全性处理AccessDenied全部内容,希望文章能够帮你解决spring – 使用方法级安全性处理AccessDenied所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。