`

spring security 3.0例子

 
阅读更多
最近学习spring-security3.0,过程很痛苦,先把一些经验总结起来
spring-security3.0.zip中有两个例子,如下
spring-security-samples- tutorial-3.0.2.RELEASE
spring-security-samples-contacts-3.0.2.RELEASEjar

1.在tutorial中
<http use-expressions="true">
        <intercept-url pattern="/secure/extreme/**" access="hasRole('ROLE_SUPERVISOR')"/>

<http use-expressions=”true”>时,一定要在配置中至少有一个符合use-expressions的表示法,否则就会报类似如下错误:

org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property
'ROLE_SUPERVISOR' cannot be found on object of type 'org.springframework.security.web.access.
expression.WebSecurityExpressionRoot'

注意:use-expressions这种表示法是不认识access=”ROLE_USER”这种写法的,正确的写法就应该为:hasRole(‘ROLE_USER’)。

在contact中
<http realm="Contacts Realm">
        <intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY"/>



  • 大小: 65.2 KB
分享到:
评论
2 楼 zhaoshijie 2014-12-16  
1 楼 z25198 2012-09-27  
[                

相关推荐

Global site tag (gtag.js) - Google Analytics