【问题标题】:Spring security ldap authenticateSpring 安全 ldap 身份验证
【发布时间】:2011-05-04 07:13:41
【问题描述】:

我已经使用以下配置设置了 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.springframework.security.authentication.UsernamePasswordAuthenticationToken@488b5f0b: Principal: test; Password: [PROTECTED]; Authenticated: false; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@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.security.web.authentication.SimpleUrlAuthenticationFailureHandler@395158
[DEBUG,TokenBasedRememberMeServices] Interactive login attempt was unsuccessful.
[DEBUG,TokenBasedRememberMeServices] Cancelling cookie

【问题讨论】:

    标签: ldap spring-security


    【解决方案1】:

    从结果来看,密码似乎不正确,所以如果您尝试输入错误的用户/密码,那么是的,这就是预期的结果。

    真的不确定您的问题是什么?你期待不同的东西吗?您是否通过了正确的凭据?

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-12-13
        • 1970-01-01
        • 2013-03-15
        • 1970-01-01
        • 1970-01-01
        • 2017-04-12
        • 1970-01-01
        • 2017-07-07
        相关资源
        最近更新 更多