-1

我正在做春季安全。当我浏览器http://localhost:8080/rest/user/json/quypham然后发生以下错误:

[警告] /rest/user/json/quypham java.lang.IllegalArgumentException:无法在 org.springframework.security.access.expression.ExpressionUtils.evalua teAsBoolean(ExpressionUtils.java:15) 在 org.springframework 评估表达式“ROLE_ADMIN” .security.web.access.expression.WebExpressionVoter .vote(WebExpressionVoter.java:36) at org.springframework.security.web.access.expression.WebExpressionVoter .vote(WebExpressionVoter.java:18) at org.springframework.security.access .vote.AffirmativeBased.decide(AffirmativeBased.java:62) at org.springframework.security.access.intercept.AbstractSecurityInterce ptor.beforeInvocation(AbstractSecurityInterceptor.java:232) at org.springframework.security.web.access.intercept.FilterSecurityInter

原因:org.springframework.expression.spel.SpelEvaluationException: EL1008E: (pos 0): 在“org.s pringframework.security.web.access.expression.WebSecurityExpressionRoot”类型的对象上找不到属性或字段“ROLE_ADMIN” -也许不公开?在 org.springframework.expression.spel.ast.PropertyOrFieldReference.read Property(PropertyOrFieldReference.java:215) 在 org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:85) 在 org.springframework.expression .spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:78) at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(Sp elNodeImpl.java:114) at org.springframework.expression.spel.standard.SpelExpression .

我认为文件中有错误的userservice-servlet.xml东西,请告诉我。

这里文件 userservice-servlet.xml

<security:http>
    <security:http-basic/>
    <security:intercept-url pattern="/rest/**" access="ROLE_ADMIN"/>            
</security:http>

<security:authentication-manager alias="authenticationManager">
    <security:authentication-provider>
        <security:user-service>
            <security:user name="datpham" password="Dat12345" authorities="ROLE_ADMIN"/>
            <security:user name="hoaipham" password="Hoai12345" authorities="ROLE_USER"/>
        </security:user-service>
    </security:authentication-provider>
</security:authentication-manager>
4

1 回答 1

0

我已将 4.0.3 版本替换spring-security-webspring-security-config3.2.4 版本。一切运行正常,但我不明白为什么????

于 2016-04-08T07:30:56.617 回答