我正在尝试使用 gitlab 配置 LDAP 身份验证。我的配置类似于:
ldap:
enabled: true
host: 'ldap.example.com'
base: 'ou=People,o=example.com'
port: 636
uid: 'uid'
method: 'ssl' # "ssl" or "plain"
bind_dn: 'cn=gitlab,ou=Apps,o=example.com'
password: 'password'
allow_username_or_email_login: true
我用以下方法对其进行了测试:
ldapsearch -b "ou=People,o=example.com" -s sub -D "cn=gitlab,ou=Apps,o=example.com" -H ldaps://ldap.example.com:636 -w "password" -x "(uid=myname@example.com)"
上面的行有效,但是当我尝试使用 LDAP 登录时,我总是得到“无效的凭据”。
如何解决此问题并缩小此问题的根本原因?
编辑 26/09:
以下是我在 production.log 上发现的一些内容:
Started GET "/users/sign_in" for 127.0.0.1 at 2013-09-23 17:42:58 -0300
Processing by Devise::SessionsController#new as HTML
Rendered devise/sessions/_new_ldap.html.haml (1.7ms)
Rendered devise/sessions/_new_base.html.haml (1.8ms)
Rendered devise/sessions/_oauth_providers.html.haml (0.0ms)
Rendered devise/sessions/new.html.haml within layouts/devise (4.2ms)
Rendered layouts/_head.html.haml (1.6ms)
Rendered layouts/_flash.html.haml (0.1ms)
Completed 200 OK in 9ms (Views: 6.9ms | ActiveRecord: 0.0ms)
Started POST "/users/auth/ldap/callback" for 127.0.0.1 at 2013-09-23 17:43:00 -0300
Processing by OmniauthCallbacksController#failure as HTML
Parameters: {"utf8"=>"â", "authenticity_token"=>"AwqZsVHRqOeZr+GLWWeGM7MyOAdk7cFl8/rZgbVRU+8=", "username"=>"name@example.com", "password"=>"[FILTERED]"}
Redirected to http://example.com/users/sign_in
Completed 302 Found in 3ms (ActiveRecord: 0.0ms)
Started GET "/users/sign_in" for 127.0.0.1 at 2013-09-23 17:43:00 -0300
Processing by Devise::SessionsController#new as HTML
Rendered devise/sessions/_new_base.html.haml (2.8ms)
Rendered devise/sessions/_oauth_providers.html.haml (0.1ms)
Rendered devise/sessions/new.html.haml within layouts/devise (3.7ms)
Rendered layouts/_head.html.haml (1.7ms)
Rendered layouts/_flash.html.haml (0.1ms)
Completed 200 OK in 9ms (Views: 6.6ms | ActiveRecord: 0.0ms)
Started GET "/" for 127.0.0.1 at 2013-09-23 18:50:08 -0300
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 1ms
编辑:我终于得到了答案:设计中的配置正在剥离“@”之后的所有内容。我不记得确切的名称,但我可以在访问机器后立即发布。我通过将日志添加到 ldap oauth 登录中发现了这一点。