我在Spring 4.1.0.RELEASE中使用Spring Security 4.1.0.RELEASE。
我有以下错误请建议我。
我的网址格式:
<intercept-url pattern="/AS/**" access="hasRole('AS')"/>
<intercept-url pattern="/SA/**" access="hasRole('SA')"/>
<intercept-url pattern="/SE/**" access="hasRole('SE')"/>
例外:
java.lang.IllegalArgumentException: Failed to evaluate expression 'SE'
org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:30)
org.springframework.security.web.access.expression.WebExpressionVoter.vote(WebExpressionVoter.java:54)
org.springframework.security.web.access.expression.WebExpressionVoter.vote(WebExpressionVoter.java:35)
org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:63)
org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:124)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
答案 0 :(得分:0)
尝试添加感叹号,例如 - access =“!hasRole('USER')”