通过设计进行LDAP身份验证——连接设置有问题



我是ldap的新手,我试图用device_ldap_authenticable gem建立与远程ldap服务器的连接,以从那里对我的用户进行身份验证。我现在有麻烦了。问题是我不确定要把什么数据放在哪里,我在控制台收到的响应看起来像这样:

LDAP: LDAP dn lookup: memberUid=n。taran
LDAP: LDAP搜索登录:memberUid = n。taran
LDAP: LDAP搜索产生8个匹配
LDAP:授权用户cn=Mail,cn=站点访问,dc=mydomain,dc=com
LDAP:未授权,因为未经过身份验证。
LDAP: LDAP dn查找:memberUid = n。taran
LDAP: LDAP搜索login:memberUid = n。taran
LDAP: LDAP搜索得到8个匹配
LDAP:授权用户cn=Mail,cn=Sites access,dc=mydomain,dc=com
LDAP:未授权,因为未验证。
完成401未授权用时960ms (ActiveRecord: 1.9ms)

这是给定的凭证,我应该在
LDAP URL: LDAP://ldap.mydomain.com
根DN:dc=mydomain,dc=com
BindDN: cn=proxy,dc=mydomain,dc=com
BindPassword: some_password
attribute: memberUid

这是我的ldap.yml:

    authorizations: &AUTHORIZATIONS
    allow_unauthenticated_bind: false
    group_base: ou=groups,dc=test,dc=com
    required_groups:
        - cn=admins,ou=groups,dc=test,dc=com
        - cn=users,ou=groups,dc=test,dc=com
        - ["moreMembers", "cn=users,ou=groups,dc=test,dc=com"]
   require_attribute:
        objectClass: inetOrgPerson
        authorizationRole: postsAdmin
   ## Environment
    development:
      host: ldap.mydomain.com
      port: 389
      attribute: memberUid
      base: dc=mydomain,dc=com
      admin_user: cn=proxy,dc=mydomain,dc=com
      admin_password: some_password
      ssl: false
      # <<: *AUTHORIZATIONS

我想验证登录,而不是电子邮件,所以这就是我的设计。Rb看起来像:

    Devise.setup do |config|
      # ==> LDAP Configuration 
    config.ldap_logger = true
    config.ldap_create_user = true
    config.ldap_update_password = true
    # config.ldap_config = "#{Rails.root}/config/ldap.yml"
    # config.ldap_check_group_membership = false
    # config.ldap_check_group_membership_without_admin = false
    # config.ldap_check_attributes = false
    config.ldap_use_admin_to_bind = true
    # config.ldap_ad_group_check = false
    #some more code
    config.authentication_keys = [:username]

谁能帮我把我的连接工作?也许,我需要什么信息或者我做错了什么?提前感谢!

更新:我已经找到了我问题的答案。问题是我的证书是错的!如果有人遇到同样的问题-对我来说,正确的属性是'uid'和正确的基数:ou=Employees,dc=mydomian,dc=com

我使用LDAP浏览器(LDAP Administrator - Softerra)来测试我计划使用的登录凭据,并在创建应用程序的LDAP配置之前检查模式。倾向于阻止挫折和意外

最新更新