2014-09-10 67 views
0

使用Spring 3.2.5安全和Spring 4.0.6。 Spring Security被配置爲使用http頭進行預身份驗證。春季安全預授權的重新驗證

春季安全正常工作抓頭,查找用戶,並從數據庫中獲取的認證角色。

的問題是,當用戶註銷並以新用戶登錄時,彈簧安全檢測不到改變的報頭和仍返回先前登錄的用戶。

1 - 登錄爲用戶#1通過外部應用程序(的SiteMinder)

2 - 彈簧安全正確地報告用戶#1在

登錄

3 - 在應用程序之外,註銷的SiteMinder

4 - 通過SiteMinder的登錄爲用戶#2

5 - 在該網絡應用程序彈簧安全現在錯誤地報告用戶#1登錄時的SiteMinder針對用戶#提供報頭信息2

在彈簧security.xml文件我嘗試添加春季安全指令,不緩存用戶,但它得到了在應用程序異常。

<security:http create-session="stateless" /> 

ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Wed Sep 10 11:57:10 MDT 2014]; root of context hierarchy 

Configuration problem: No AuthenticationEntryPoint could be established. Please make sure you have a login mechanism configured through the namespace (such as form-login) or specify a custom AuthenticationEntryPoint with the 'entry-point-ref' attribute 

當預認證頭更改時,spring security如何配置爲重新授權?

謝謝!

回答

1

您應該能夠通過設置在auth預過濾器,以真checkForPrincipalChanges屬性來實現這一目標。

從API文檔:

預認證主體會在每個請求進行檢查和對當前的認證對象的名稱進行比較。如果檢測到更改,用戶將被重新認證。

您可能還想設置invalidateSessionOnPrincipalChange屬性(如果您希望以前的會話被遺忘)。

+0

這做到了!因爲沒有閱讀手冊,我覺得這是一個小菜。謝謝! – 2014-09-10 20:55:26