Hi all,
I''ve LDAP basic authentication working using NET::LDAP.
#####################################################
require ''ldap_auth''
#LDAP connection info
#
host= ''myldapserver'' #Your ldap server
dn = ''CN=users,DC=org,DC=com''
#Credentials of the user we are trying to authenticate
#
account_name = ''somename''
password = ''somepass''
print "#{account_name} "
unless LDAP::Auth.authenticate("#{account_name}", password, dn, host)
do
|auth_obj|
puts ''authenticated!''
puts ''Group info:''
groups = auth_obj.groups_for(account_name,
''sAMAccountName'',
''memberOf''){|group|puts group}
puts groups.inspect
puts
puts ''Some attributes:''
attributes = auth_obj.attributes_for(account_name,
''sAMAccountName'',
[''sn'', ''givenName'',
''mail'', ]){|name, value| puts "#{name} = #{value}"}
puts attributes.inspect
end
puts ''authentication failed! Bad account name and/or
password''
end
####################################################
o/p> someone authenticated!
Group info:
[]
Some attributes:
{}
#######################
It is working and put ''authenticated'' message for valid user.
But I am
unable to get groupinfo and other attributes.
Can I use this authentication to retrieve data from MYSql database?
How to get groupinfo and user attributes?
Please help me out.
Thanks,
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---