2011-06-18 17 views
5

JSF WebサイトでSpring Security 3.0.2 LDAP認証を使用しようとしています。 applicationContext-security.xmlで以下の設定を使用すると、この例外が発生します。org.springframework.beans.factory.BeanCreationException: 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0'という名前のBeanを作成中にエラーが発生しました。 :Beanの初期化に失敗しました。ネストされた例外はorg.springframework.context.ApplicationContextException:No UserDetailsS​​erviceが登録されています。Spring LDAP例外 - No UserDetailsS​​erviceが登録されています

<authentication-manager> 
    <ldap-authentication-provider 
     user-search-filter="(uid={0})" user-search-base="ou=users,ou=system" 
     group-search-base="ou=groups,ou=system"> 
    </ldap-authentication-provider> 
</authentication-manager> 

<ldap-server id="ldapServer" url="ldap://localhost:10389" 
    root="" /> 

私はちょうど実験したところ、以下を追加すると動作します。

<ldap-user-service server-ref="ldapServer" user-search-filter="(uid={0})" /> 

しかし、私はSpring LDAP documentationでこれへの参照を見つけることができませんでした。これを追加しないと上記の例外が発生するのはなぜですか?私は2つの場所でuser-search-filter属性を書く必要があるので、この回避策に満足できません。

PSSpring Security LDAP - No UserDetailsService registeredをチェックしました。例外は異なりますし、Spring Securityのバージョンも異なっていると思います。

答えて

8

<remember-me/>がセキュリティコンテキストで後で設定されていると思われます。 http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#remember-me

あなたは UserDetailsS​​ervice(例えば、LDAPプロバイダ)を使用していない認証プロバイダを使用している場合もでUserDetailsS​​ervice Beanを持っていない限り、それは を動作しません:ドキュメントあたりとしてあなたのアプリケーション コンテキスト。

関連する問題