2010-11-03 286 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檢索的密碼 - 這是空的 - 然後失敗。