【问题标题】:Spring security ldap authenticate firstSpring Security ldap 首先进行身份验证
【发布时间】:2011-02-01 09:28:46
【问题描述】:

我已经使用以下配置设置了 ldap 身份验证。我只需要用户对 LDAP 数据存储进行身份验证,然后让他们的会话获取身份验证令牌。通过阅读文档,这就是我认为应该发生的事情:

  1. 认证为经理,根据搜索条件查找用户全dn
  2. 尝试以用户身份(使用他们的完整 dn)和提供的密码进行绑定

日志似乎没有提供足够的信息来说明失败的原因。它只是说无效的凭据-当我知道它们有效时。我的想法是正在发生以下情况之一:

  1. 未找到用户的完整 DN,他们只是在使用用户名进行身份验证
  2. 它正在尝试进行密码比较,而不是实际尝试绑定到目录

配置:

<ldap-server 
    url="ldap://adapps.company.com:389/dc=company,dc=com" 
    manager-dn="cn=fulluserdn,dc=company,dc=com" 
    manager-password="password"/>
<ldap-user-service user-search-base="" user-search-filter="(samaccountname={0})"/>  
<authentication-manager>
<ldap-authentication-provider user-search-filter="(samaccountname={0})" user-search-base="dc=company,dc=com"/>
</authentication-manager>

错误日志:

[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】:

    问题在于 LDAP 服务器在不同的端口上运行,但正常端口仍处于打开状态。

    【讨论】:

      猜你喜欢
      • 2018-08-09
      • 2012-11-18
      • 2012-02-18
      • 2016-09-01
      • 2013-03-06
      • 2015-11-22
      • 2015-10-20
      • 2016-09-09
      • 2013-01-11
      相关资源
      最近更新 更多