我有雙重身份驗證問題。我通過始終位於頂部的彈出窗口實現了身份驗證表單。但我有問題可能與應用,甚至在開始之前,使被Tomcat的認證請求攔截器:GWT/EXT + Spring Security應用程序中的雙重身份驗證
用戶名和密碼都被http://127.0.0.1:8888要求。 該網站說:「春季安全應用」
如果我禁用攔截器,我在日誌中看到,SecurityContextHolder中把用戶作爲匿名。
所以我的問題是: 我可以以某種方式禁用第一個Tomcat登錄屏幕?
我的春天,安全配置XML是:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<authentication-manager alias="authenticationManager">
<authentication-provider ref="customAuthenticationProvider"/>
</authentication-manager>
<beans:bean id="customAuthenticationProvider" class="com.myCompany.model.security.CustomAuthenticationProvider" >
<beans:property name="databaseId" value="${configuration.databaseId}" />
<beans:property name="applicationId" value="${configuration.applicationId}" />
</beans:bean>
<http auto-config="true" >
<intercept-url pattern="/myApp/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/MyApp.html*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/gwt/**" access="ROLE_USER"/>
<intercept-url pattern="/**/*.html" access="ROLE_USER"/>
<intercept-url pattern="/css/**" filters="none"/>
<intercept-url pattern="/**" access="ROLE_USER" />
<http-basic />
</http>
<global-method-security secured-annotations="enabled" />
</beans:beans>
你的問題是,Spring Security基於重定向。我曾經試圖與它鬥爭,但它需要深入SS內部,所以我已經從這個想法中辭職了。在我看來,使用SS只是過濾頻道,在這種情況下,簡單的HttpFilter就足夠了。 –
@lechlukasz:我不確定你期望我做什麼。你能寫一些詳細的解釋嗎? 我試圖除去所有攔截器,並只留下這一個: '<截距-URL模式= '/ **' 存取= 'ROLE_ANONYMOUS,ROLE_CHANGE_PASS,ROLE_VIEWER,ROLE_USER,ROLE_ADMIN'/>' 但SS對待用戶作爲匿名,即使在認證之後。 – Mario