【发布时间】:2014-05-23 15:00:06
【问题描述】:
我在基于 Spring MVC 的 Web 应用程序中设置了 Spring Security。但是由于某些外部系统限制,我希望用户 roles 使用小写字母。
但是当使用 In Memory Users 进行本地测试时,应用程序仅在经过身份验证的用户在 UPPER_CASE 中具有角色时才允许访问,并在我将角色更改为小写时立即给出 403。
是否有这样的限制,只有大写的角色。我在文档中找不到任何提及它的内容?
我还发现 filter-invocation-definition-source 的属性 lowercase-comparisons.. 这是用于比较 URL 或角色吗?
下面是FilterSecurityInterceptor的定义:
<bean id="fsi" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager" />
<property name="accessDecisionManager" ref="accessDecisionManager" />
<property name="objectDefinitionSource">
<sec:filter-invocation-definition-source lowercase-comparisons="true">
<sec:intercept-url pattern="/logout.jsp" access="ROLE_ANONYMOUS" />
<sec:intercept-url pattern="/welcome.htm" access="ROLE_executer,ROLE_viewer,ROLE_admin_user" />
<!-- Write Access -->
<sec:intercept-url pattern="/addNewRecord.htm" access="ROLE_executer,ROLE_admin_user" />
<sec:intercept-url pattern="/updateRecord.htm" access="ROLE_executer,ROLE_admin_user" />
<sec:intercept-url pattern="/deleteRecord.htm" access="ROLE_executer,ROLE_admin_user" />
<sec:intercept-url pattern="/uploadFile.htm" access="ROLE_executer,ROLE_admin_user" />
<!-- Read Access to All Other-->
<sec:intercept-url pattern="/**" access="ROLE_executer,ROLE_viewer,ROLE_admin_user"/>
</sec:filter-invocation-definition-source>
</property>
</bean>
感谢您的帮助。
【问题讨论】: