2010-02-03 54 views
1

我與春天的安全配置問題彈簧安全不拿起我的認證管理器

這裏擰是我的配置

<security:global-method-security pre-post-annotations="enabled" /> 

<security:http auto-config="true"> 
    <security:intercept-url pattern="/dologin"  access="ROLE_USER,ROLE_ANONYMOUS" /> 
    <security:form-login login-processing-url="/security_check" login-page="/onlogin" always-use-default-target="false" authentication-failure-url="/onlogin" default-target-url="/home" /> 
    <security:logout invalidate-session="true" logout-url="/logout" logout-success-url="/onlogout" /> 
    <security:remember-me /> 
    <security:http-basic/> 
</security:http> 

<security:authentication-manager alias="authenticationManager"> 
    <security:authentication-provider ref="daoAuthenticationProvider"/> 
</security:authentication-manager> 

<bean id="anonymousAuthenticationProvider" 
    class="org.springframework.security.authentication.AnonymousAuthenticationProvider"> 
    <property name="key" value="badgerbadgerbadger" /> 
</bean> 

<bean id="daoAuthenticationProvider" 
    class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> 
    <property name="userDetailsService" ref="userDetailsService" /> 
</bean> 

我的問題是,當請求進行認證;我發現只有兩家提供商註冊。

org.springfr[email protected]8fe4ad 
org.springfra[email protected]1db9cb9 

我可能會出錯嗎?請描述一下?

回答

1

我相信你需要通過使用安全性:自定義身份驗證提供程序標記來識別自定義提供程序以確保安全。

例如:

<bean id="daoAuthenticationProvider" 
    class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> 
    <security:custom-authentication-provider /> 
    <property name="userDetailsService" ref="userDetailsService" /> 
</bean> 

則可能需要您anonymousAuthenticationProvider豆也。

+0

嗨Donal Boyle, 我使用的是spring-security 3.0版。並且它沒有任何標籤,如 我試圖找出在配置文件中找到安全標籤時會發生什麼情況。但是我的加速沒有任何結果。 現在我選擇了完全基於bean定義的配置。我會告訴你任何與這個主題相關的事情 – 2010-02-07 06:54:42

1

嘗試以下操作:

<security:authentication-manager> 
    <security:authentication-provider user-service-ref="userDetailsService"/> 
</security:authentication-manager> 
1
在你需要把DaoAuthenticationProvider

你必須UserDetailsS​​ervice的一個參考,但我並不在你的配置看到這樣的豆。
檢查以前的錯誤消息,我期望看到在那裏提到錯過的bean。