Spring Security 3.1 支持多个 http 元素。
我希望我们的移动网站的安全性基本上总是需要登录,而“普通”网站将有更多的公共页面。
我正在考虑为此使用 Spring Security 的多个 http 元素功能,但我找不到任何关于在模式字段中使用服务器名称 (egmsite.com) 等变量的信息。
我可以在 http 模式字段中使用请求变量吗?如果是这样,怎么做?
这是我尝试过的一些代码:
<http security="none" pattern="/assets/**"/>
<!--
<http use-expressions="true" request-matcher-ref="mobileHttpConfigSelector" entry-point-ref="myAuthenticationProcessingFilterEntryPoint" >
<intercept-url pattern="/*/*/login.html" access="permitAll" />
<intercept-url pattern="/*/*/registration/**" access="permitAll" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<anonymous enabled="true" granted-authority="ROLE_ANONYMOUS"/>
<remember-me services-ref="rememberMeServices" key="${msa.security.key}" use-secure-cookie="true"/>
<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
<custom-filter position="FORM_LOGIN_FILTER" ref="myUserPassFilter"/>
<custom-filter position="LOGOUT_FILTER" ref="myLogoutFilter"/>
<custom-filter ref="countrySelectFilter" before="FIRST" />
<custom-filter ref="userAgentFilter" before="LAST" />
<session-management invalid-session-url="/" session-authentication-strategy-ref="sas">
</session-management>
</http>
-->
<http use-expressions="true" entry-point-ref="myAuthenticationProcessingFilterEntryPoint" >
<intercept-url pattern="/*/*/account/**" access="isAuthenticated()" />
<intercept-url pattern="/**" access="permitAll" />
<anonymous enabled="true" granted-authority="ROLE_ANONYMOUS"/>
<remember-me services-ref="rememberMeServices" key="${msa.security.key}" use-secure-cookie="true"/>
<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
<custom-filter position="FORM_LOGIN_FILTER" ref="myUserPassFilter"/>
<custom-filter position="LOGOUT_FILTER" ref="myLogoutFilter"/>
<custom-filter ref="countrySelectFilter" before="FIRST" />
<custom-filter ref="userAgentFilter" before="LAST" />
<session-management invalid-session-url="/" session-authentication-strategy-ref="sas">
<!-- <concurrency-control max-sessions="2" error-if-maximum-exceeded="false" session-registry-alias="sessionRegistry"/>-->
</session-management>
</http>
<global-method-security secured-annotations="enabled" pre-post-annotations="enabled"/>
<beans:bean id="mobileHttpConfigSelector" class="nl.msw.compraventa.interceptor.security.MobileHttpConfigSelector"/>
带有 mobileHttpConfigSelector 的 http 部分已被注释掉,因为如果我激活我得到 No unique bean of type [org.springframework.security.web.context.SecurityContextRepository] is defined。
亲切的问候,马克