我使用spring-mvc的spring-security web身份驗證,目前爲止都很好,但現在我正在爲我設計的移動版本的應用程序進行設計一個不同的移動網站頁面集,其中包含一個不同的登錄頁面。現在我的,我有配置的問題,使用Spring Security時移動和桌面的不同登錄頁面
,這裏是我的applicationContext-security.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http auto-config="true" lowercase-comparisons="false">
<intercept-url pattern="/images/**" filters="none" />
<intercept-url pattern="/Stylesheets/**" filters="none" />
<intercept-url pattern="/JavaScript/**" filters="none" />
<intercept-url pattern="/scripts/**" filters="none" />
<intercept-url pattern="/favicon.ico" access="ROLE_ANONYMOUS" />
<intercept-url pattern="/**" access="ROLE_USER,ROLE_ADMIN"/>
<intercept-url pattern="/mobile/**" access="ROLE_USER,ROLE_ADMIN"/>
<form-login login-page="/login.htm" authentication-success-handler-ref="customHandler"
authentication-failure-url="/login.htm?error=true" default-target-url="/home.htm"
login-processing-url="/j_security_check" />
<remember-me user-service-ref="userDAO" key="e37f4b31-0c46-11dd-bd0b-0800200c9a66"/>
</http>
<beans:bean id="customHandler" class="com.example.auth.AuthenticationHandler">
</beans:bean>
<authentication-manager>
<authentication-provider user-service-ref="userDAO">
<!--
TODO skipped to allow password emailing instead of password change and security
TODO question hell..
-->
<!-- <password-encoder ref="passwordEncoder"/> -->
</authentication-provider>
</authentication-manager>
</beans:beans>
現在我怎麼能有根據不同的要求多次登錄頁面,我的意思是如果移動文件夾中的頁面比用戶應顯示移動登錄頁面。 我已經看到了類似的問題在stackoverflow,但這些登錄頁面根據不同的角色,但在我的情況下,我想diff登錄不同的頁面。
嗨,感謝您的解決方案,它似乎可以爲我工作得很好。我現在已經轉向了Spring 3.1,但它給了我一個例外。你能幫我解決這個問題嗎?
Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#4' while setting bean property 'sourceList' with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#4': Cannot create inner bean '(inner bean)' of type [org.springframework.security.web.authentication.logout.LogoutFilter] while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6': Cannot resolve reference to bean 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0': Cannot create inner bean '(inner bean)' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#7': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Property 'sessionFactory' is required for bean '(inner bean)#7'
嗨,感謝您的解決方案,它似乎能爲我工作得很好。我現在已經轉向了Spring 3.1,但它給了我一個例外。你能幫我解決這個問題嗎? – 2012-03-10 07:08:20