2010-11-03 233 views
1

我已经使用以下配置设置了ldap身份验证。我只需要用户对LDAP数据存储进行身份验证,然后让他们的会话获得身份验证令牌。从阅读的文档,这就是我的想法是应该发生:春季安全ldap验证

applicationContextSecurity.xml 

<ldap-server id="contextSource" 
    url="ldap://192.168.0.1:389/DC=cn,DC=bleum,DC=com" 
    manager-dn="cn=buddy,ou=Neil,OU=Development,OU=Micosoft,DC=cn,DC=Micosoft,DC=com" 
    manager-password="A,1234567890" /> 

<authentication-manager alias="authenticationManager" erase-credentials="true"> 
    <!--<authentication-provider user-service-ref="securityManagerSupport"/> --> 
    <ldap-authentication-provider server-ref="contextSource" role-prefix="none" user-search-filter="(uid={0})" 
     user-search-base="ou=Neil,OU=Development,OU=Micosoft" user-context-mapper-ref="contextMapper"> 
    </ldap-authentication-provider> 
</authentication-manager> 

<beans:bean id="contextMapper" class="com.micosoft.neil.security.UserDetailsContextMapperSupport"/> 


Error: 

[DEBUG,FilterBasedLdapUserSearch] Searching for user 'test', with user search [ searchFilter: '(samaccountname={0})', searchBase: 'dc=company,dc=com', scope: subtree, searchTimeLimit: 0, derefLinkFlag: false ] 
[DEBUG,AbstractContextSource] Got Ldap context on server 'ldap://adapps.company.com:389/dc=company,dc=com' 
[INFO,SpringSecurityLdapTemplate] Ignoring PartialResultException 
[DEBUG,XmlWebApplicationContext] Publishing event in Root WebApplicationContext: org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent[source=org.springframew[email protected]488b5f0b: Principal: test; Password: [PROTECTED]; Authenticated: false; Details: org.sprin[email protected]fffd148a: RemoteIpAddress: 127.0.0.1; SessionId: 0718B7EED3F930C63C03DA97C4344CBD; Not granted any authorities] 
[DEBUG,UsernamePasswordAuthenticationFilter] Authentication request failed: org.springframework.security.authentication.BadCredentialsException: Bad credentials 
[DEBUG,UsernamePasswordAuthenticationFilter] Updated SecurityContextHolder to contain null Authentication 
[DEBUG,UsernamePasswordAuthenticationFilter] Delegating to authentication failure handlerorg.springframework.se[email protected]395158 
[DEBUG,TokenBasedRememberMeServices] Interactive login attempt was unsuccessful. 
[DEBUG,TokenBasedRememberMeServices] Cancelling cookie 
+2

你的问题是什么? – 2010-11-03 03:59:42

回答

0

从结果,它看起来像密码是不正确的,所以如果你试图输入不正确的用户名/密码,然后是,这是预期的。

真的不确定你的问题是什么?你期望有什么不同吗?你传递了正确的凭证吗?

0

我有几乎相同的配置相同的错误。我还不能给你一个答案(对不起!),但通过Spring类运行调试器,似乎他们试图比较用户作为字符串输入的密码(并且调试器确认它是正确的密码)到从LDAP检索的密码 - 这是空的 - 然后失败。