Cra*_*ker 5 spring-security spring-ldap
我正在尝试为JSF网站使用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:没有注册UserDetailsService.
<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="" />
Run Code Online (Sandbox Code Playgroud)
我刚刚进行了实验,发现添加以下内容可以使事情发挥作用.
<ldap-user-service server-ref="ldapServer" user-search-filter="(uid={0})" />
Run Code Online (Sandbox Code Playgroud)
但我在Spring LDAP文档中找不到对此的引用.如果我不添加此内容,为什么会出现上述异常?我对这种解决方法不满意,因为我需要在两个地方编写user-search-filter属性.
PS:我已经检查过Spring Security LDAP - 没有注册UserDetailsService.异常是不同的,我猜Spring Security版本也不同.
我怀疑你<remember-me/>后来在安全上下文中设置了.根据文件:http:
//static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#remember-me
如果您使用的身份验证提供程序不使用UserDetailsService(例如,LDAP提供程序),那么除非您的应用程序上下文中还有UserDetailsService bean,否则它将无法工作.
| 归档时间: |
|
| 查看次数: |
3593 次 |
| 最近记录: |