Active Directory in Ruby on rails

  • Thread starter Periyasamy Ramachandiran
  • Start date
P

Periyasamy Ramachandiran

Hi All,

What is Active Directory authentication?. How to use in Ruby on rails?.


Regards,

Periyasamy.R
 
B

brabuhr

What is Active Directory authentication?. How to use in Ruby on rails?.

Using Apache SSPI:
http://www.zorched.net/2007/06/04/active-directory-authentication-for-ruby-on-rails/

Using LDAP:
http://www.ruby-forum.com/topic/55450#37973

A slightly different version using LDAP:

require 'net/ldap'
class User
def self.authenticate(username, password)
return false if username.to_s.size == 0
return false if password.to_s.size == 0

begin
ldap = Net::LDAP.new(
:host => AD_DOMAIN_CONTROLLER,
:port => 389,
:auth => {
:method => :simple,
:username => "#{username}", # <- AD UPN
:password => "#{password}"
}
)
rescue
return false
end

ldap.bind ? User.find_by_login("#{username}") : nil
end
end
 
P

Periyasamy Ramachandiran

unknown said:
Using Apache SSPI:
http://www.zorched.net/2007/06/04/active-directory-authentication-for-ruby-on-rails/

Using LDAP:
http://www.ruby-forum.com/topic/55450#37973

A slightly different version using LDAP:

require 'net/ldap'
class User
def self.authenticate(username, password)
return false if username.to_s.size == 0
return false if password.to_s.size == 0

begin
ldap = Net::LDAP.new(
:host => AD_DOMAIN_CONTROLLER,
:port => 389,
:auth => {
:method => :simple,
:username => "#{username}", # <- AD UPN
:password => "#{password}"
}
)
rescue
return false
end

ldap.bind ? User.find_by_login("#{username}") : nil
end
end


Hi,

Great!. It worked for me.


Thanks,
Periyasamy.R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top