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 セクションはコメント アウトされています。有効にすると、[org.springframework.security.web.context.SecurityContextRepository] 型の一意の Bean が定義されていないためです。
よろしく、 マーク