Spring Security授权 AccessDecisionManager
2016-12-28 17:12
309 查看
Spring Security授权 AccessDecisionManager
博客分类:Security
Spring
在前面那篇博客有一段配置:
Xml代码
<http auto-config="false" disable-url-rewriting="true" use-expressions="true" entry-point-ref="dtAuth"
create-session="never">
<!-- <session-management session-authentication-strategy-ref="dtsession"/> -->
<intercept-url pattern="/unread/get" access="isAuthenticated()"/>
<intercept-url pattern="/authtest.xhtm" access="hasRole('working')"/>
<intercept-url pattern="/authtest1.xhtm" access="hasRole('trac')"/>
<intercept-url pattern="/cmmt/uc" access="isAuthenticated()"/>
<intercept-url pattern="/favicon.ico" access="denyAll"/>
<intercept-url pattern="/**" access="permitAll"/>
<custom-filter position="PRE_AUTH_FILTER" ref="dtSessionMgr"/>
</http>
pattern表示url,access表示url的权限,但这个isAuthenticated()具体在哪里执行呢?原来Spring提供授权机制,由org.springframework.security.access.AccessDecisionManager这个接口来实现。
这个接口定义了这个方法:
Java代码
void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes)
throws AccessDeniedException, InsufficientAuthenticationException;
对应上面的配置:object就是url,configAttributes就是一个access。常用的实现类是AffirmativeBased
相关文章推荐
- 常用加密算法的Java实现总结(二)——对称加密算法DES、3DES和AES
- 使用eclipse中egit clone csdn code中的项目
- Struts进阶学习
- 常用加密算法的Java实现(一)——单向加密算法MD5和SHA
- Java中六大时间类的使用和区别
- 文件夹的复制--递归算法
- Java根据当前日期获得这一周的日期
- LeetCode459——Repeated Substring Pattern
- Java8系列之重新认识HashMap
- 13. 处理静态资源【从零开始学Spring Boot】
- java自动判断文件编码格式
- JavaWeb博客推荐
- SpringMVC redirect乱码问题
- java中if和switch哪个效率快
- Java Socket长连接示例代码
- Struts2配置描述及项目走向流转
- SpringMVC配置@Responsebody返回json不带转义字符
- Java socket长连接代码实现
- Struts框架学习基础
- java编程学习日志 第一课:小白的奋斗之路