通过 Devise 进行 LDAP 身份验证 - 连接设置有问题
LDAP authentication via Devise - having troubles with connection setup
我是 ldap 的新手,我正在尝试使用 devise_ldap_authenticable gem 建立到远程 ldap 服务器的连接,以便从那里验证我的用户。我遇到了麻烦。问题是我不太确定将什么数据放在哪里,我在控制台中收到的响应如下所示:
LDAP: LDAP dn lookup: memberUid=n.taran
LDAP: LDAP search for
login: memberUid=n.taran
LDAP: LDAP search yielded 8 matches
LDAP: Authorizing user cn=Mail,cn=Sites access,dc=mydomain,dc=com
LDAP: Not authorized because not authenticated.
LDAP: LDAP dn
lookup: memberUid=n.taran
LDAP: LDAP search for login:
memberUid=n.taran
LDAP: LDAP search yielded 8 matches
LDAP:
Authorizing user cn=Mail,cn=Sites access,dc=mydomain,dc=com
LDAP:
Not authorized because not authenticated.
Completed 401
Unauthorized in 960ms (ActiveRecord: 1.9ms)
This is the given credentials which I should use in the
connection:
LDAP URL: ldap://ldap.mydomain.com
Root 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
我想通过登录而不是电子邮件进行身份验证,所以这就是我的 devise.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 管理员 - Softerra)来测试我计划使用的登录凭据并在创建应用程序的 LDAP 配置之前检查模式。倾向于避免沮丧和惊喜。
我是 ldap 的新手,我正在尝试使用 devise_ldap_authenticable gem 建立到远程 ldap 服务器的连接,以便从那里验证我的用户。我遇到了麻烦。问题是我不太确定将什么数据放在哪里,我在控制台中收到的响应如下所示:
LDAP: LDAP dn lookup: memberUid=n.taran
LDAP: LDAP search for login: memberUid=n.taran
LDAP: LDAP search yielded 8 matches
LDAP: Authorizing user cn=Mail,cn=Sites access,dc=mydomain,dc=com
LDAP: Not authorized because not authenticated.
LDAP: LDAP dn lookup: memberUid=n.taran
LDAP: LDAP search for login: memberUid=n.taran
LDAP: LDAP search yielded 8 matches
LDAP: Authorizing user cn=Mail,cn=Sites access,dc=mydomain,dc=com
LDAP: Not authorized because not authenticated.
Completed 401 Unauthorized in 960ms (ActiveRecord: 1.9ms)This is the given credentials which I should use in the connection:
LDAP URL: ldap://ldap.mydomain.com
Root 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
我想通过登录而不是电子邮件进行身份验证,所以这就是我的 devise.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 管理员 - Softerra)来测试我计划使用的登录凭据并在创建应用程序的 LDAP 配置之前检查模式。倾向于避免沮丧和惊喜。