如何使ldap与rails配合工作? [英] How to make ldap work with devise in rails?

查看:158
本文介绍了如何使ldap与rails配合工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用devise,我尝试使用ldap,我的所有尝试都导致失败。
我已经遵循 http://vimeo.com/13105005
,我真的看求助。

I am using devise and i try to use ldap and all my attempts resulted in failure. I have followed http://vimeo.com/13105005 and I am really looking for help.

Started POST "/users/sign_in" for 127.0.0.1 at 2013-04-16 18:01:54 +0530
Processing by Devise::SessionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"N7Xkqk8nHWqK4tgiCxyX4wFccSO8ozhy+nxXqS19arA=", "user"=>{"email"=>"logesh@gmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
WARNING: Can't verify CSRF token authenticity
  User Load (0.6ms)  SELECT "users".* FROM "users" WHERE "users"."email" = 'logesh@gmail.com' LIMIT 1
  LDAP: LDAP dn lookup: cn=logesh@gmail.com
  LDAP: LDAP search for login: cn=logesh@gmail.com
  LDAP: Authorizing user cn=logesh@gmail.com,dc=server,dc=local
  LDAP: LDAP dn lookup: cn=logesh@gmail.com
  LDAP: LDAP search for login: cn=logesh@gmail.com
DEPRECATION WARNING: an empty resource was given to Devise::Strategies::LdapAuthenticatable#validate. Please ensure the resource is not nil. (called from service at /Users/logesh/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/webrick/httpserver.rb:111)
Completed 401 Unauthorized in 13ms
Processing by Devise::SessionsController#new as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"N7Xkqk8nHWqK4tgiCxyX4wFccSO8ozhy+nxXqS19arA=", "user"=>{"email"=>"logesh@gmail.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
WARNING: Can't verify CSRF token authenticity
  Rendered devise/shared/_links.erb (0.4ms)
  Rendered devise/sessions/new.html.erb within layouts/application (3.1ms)
Completed 200 OK in 8ms (Views: 6.5ms | ActiveRecord: 0.0ms)

我不知道如何向前迈进我正在努力工作约2天,仍然无法解决。

I do not know how to step forward. I am struggling with this for about 2 days and still could not resolve.

当我注册时,用户被保存在用户模型中,但登录不起作用。请帮助我。

when i signup the user is saved in user model but login doesnt work. please help me.

推荐答案

可能在您正在使用的LDAP目录中,而不是命名属性为 cn=logesh@gmail.com ,而是邮件属性具有这个值,而完整的DN是不同的:
cn = logesh @ gmail .com,dc = server,dc = local

Is it possible that in the LDAP directory you are using, rather than the naming attribute being cn=logesh@gmail.com, rather the mail attribute has that value, and the full DN is something other than: cn=logesh@gmail.com,dc=server,dc=local

因此,如果可能,您的配置应该搜索mail=logesh@gmail.com然后从该用户对象获取DN,然后尝试绑定。

Thus, your config, if possible should search for mail=logesh@gmail.com to then get the DN from that user object to then attempt to bind.

这篇关于如何使ldap与rails配合工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆