2
我有多個<http.../>
元件(爲了分別支持通過基本認證REST authetication和用戶形式登錄)以下配置:Spring Security 3.1.0.RC1:有多個<http.../>元素爲什麼我只能註冊一個認證管理器?
<security:http auto-config="false" pattern="/service/**" create-session="never"
entry-point-ref="basicAuthenticationEntryPoint" >
<security:intercept-url pattern="/service/**" requires-channel="any" access="ROLE_REST_SERVICE" />
<security:custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthenticationFilter" />
</security:http>
<security:http auto-config="false" pattern="/**"
entry-point-ref="loginUrlAuthenticationEntryPoint" >
<security:logout logout-url="/logout" />
<security:anonymous enabled="false"/>
<security:custom-filter position="FORM_LOGIN_FILTER" ref="usernamePasswordAuthenticationFilter" />
<security:custom-filter position="ANONYMOUS_FILTER" ref="anonymousAuthFilter" />
</security:http>
在我的每一個要求認證兩個濾波器(FORM_LOGIN_FILTER,和BASIC_AUTH_FILTER)我引用了兩個不同的認證管理器
但我得到一個錯誤,我已經註冊了一個身份驗證管理器。
當我事先知道每個過濾器需要哪個身份驗證提供程序時,爲什麼我會使用一個身份驗證管理器?
我不應該使用身份驗證管理器,只需將我的AuthenticationProvider
作爲bean啓動,並直接將其作爲AuthenticationManager
傳遞給過濾器?
這是在相關SpringSource論壇上您應該詢問SpringSecurity開發人員的一類問題。根據我的經驗,他們確實回答了這類問題,但答案並不總是您想要聽到的。 – 2011-03-18 04:52:20
我現在也這樣做了。我發現在春季論壇上的迴應是平淡無奇的,至少在春季框架論壇上。也許安全社區更加活躍。 – 2011-03-18 09:26:23