Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 请给出Rails/designe/LDAP designe::LdapAdapter.get_LDAP_param用法的示例_Ruby On Rails 3_Devise_Ldap - Fatal编程技术网

Ruby on rails 3 请给出Rails/designe/LDAP designe::LdapAdapter.get_LDAP_param用法的示例

Ruby on rails 3 请给出Rails/designe/LDAP designe::LdapAdapter.get_LDAP_param用法的示例,ruby-on-rails-3,devise,ldap,Ruby On Rails 3,Devise,Ldap,我一直在使用get_ldap_param对eDir ldap服务器进行身份验证。我可以进行身份验证,但当我尝试读取属性时,什么也得不到 def get_ldap_email self.email = Devise::LdapAdapter.get_ldap_param(self.uid, "mail") end def get_ldap_category self.category = Devise::LdapAdapter.get_ldap_param(self.uid, "c

我一直在使用get_ldap_param对eDir ldap服务器进行身份验证。我可以进行身份验证,但当我尝试读取属性时,什么也得不到

def get_ldap_email
    self.email = Devise::LdapAdapter.get_ldap_param(self.uid, "mail")
end

def get_ldap_category
   self.category = Devise::LdapAdapter.get_ldap_param(self.uid, "category")
end
在我的ndstrace.log中

92659520 LDAP: [2011/11/14 10:10:07.401] New cleartext connection 0xe4b26c0 from     192.168.21.40:58658, monitor = 0x4b37c940, index = 8
1256683840 LDAP: [2011/11/14 10:10:07.401] DoBind on connection 0xe4b26c0
1256683840 LDAP: [2011/11/14 10:10:07.401] Bind name:cn=admin,o=xxx, version:3, authentication:simple
1256683840 LDAP: [2011/11/14 10:10:07.401] Sending operation result 0:"":"" to connection 0xe4b26c0
1310226752 LDAP: [2011/11/14 10:10:07.402] DoSearch on connection 0xe4b26c0
1310226752 LDAP: [2011/11/14 10:10:07.402] Search request:
base: "cn=ntr,ou=Meta,o=xxx"
scope:0  dereference:0  sizelimit:0  timelimit:0  attrsonly:0
filter: "(objectclass=*)"
no attributes
1310226752 LDAP: [2011/11/14 10:10:07.402] Empty attribute list implies all user attributes
1310226752 LDAP: [2011/11/14 10:10:07.403] Sending search result entry "cn=ntr,ou=Meta,o=xxx" to connection 0xe4b26c0
1310226752 LDAP: [2011/11/14 10:10:07.403] Sending operation result 0:"":"" to connection 0xe4b26c0
1261947200 LDAP: [2011/11/14 10:10:07.405] Monitor 0x4b37c940 found connection 0xe4b26c0 socket closed, err = -5871, 0 of 0 bytes read
1261947200 LDAP: [2011/11/14 10:10:07.405] Monitor 0x4b37c940 initiating close for connection 0xe4b26c0
1251420480 LDAP: [2011/11/14 10:10:07.405] Server closing connection 0xe4b26c0, socket error = -5871
1251420480 LDAP: [2011/11/14 10:10:07.405] Connection 0xe4b26c0 closed
登录后出现的错误:

NoMethodError in Devise::SessionsController#create

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
Rails.root: /home/ntr/Dropbox/source/devise

Application Trace | Framework Trace | Full Trace
Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"nkuzPnh8MCK4rh/RXUErrAjVJB9ciy56hfavG60I8ck=",
 "user"=>{"uid"=>"ntr",
 "password"=>"[FILTERED]",
 "remember_me"=>"0"},
 "commit"=>"Logga in"}
Show session dump

Show env dump

Response

Headers:

None
我一直在网上到处寻找这方面的教程,但只找到了Desive_ldap插件的基本实现。未使用get_ldap_参数

希望得到一些例子,提示等


//罗杰

dstrace显示您正在获得返回的所有属性:

空属性列表表示所有用户属性

但它不再在dstrace中显示返回的数据。旧的eDirectory在某一点上确实在跟踪中显示了结果,但现在已经不是很长时间了


所以我建议eDir将数据发回。现在让我们来看看你的应用程序是如何解析该响应的。

部分问题在于,目前Desive_ldap_authenticatable gem没有向该函数传递身份验证密码


我希望有一个回调,可以从LDAP响应中从身份验证中获得更多,但这似乎是不可能的

除了get_ldap_param方法之外,我没有在我的应用程序中进行任何解析,我在迁移电子邮件和类别时添加了列。我还将:email和:类别添加到我的用户模型中可访问的属性中。。。问题是ldap返回了什么?我问的问题不对,因为ldap认为它应该返回所有内容。很明显,我的对象中有一个邮件属性,但是我的LDAP服务器说查询是空的?