From: Periyasamy Ramachandiran on 24 May 2010 06:27 Hi All, What is Active Directory authentication?. How to use in Ruby on rails?. Regards, Periyasamy.R -- Posted via http://www.ruby-forum.com/.
From: brabuhr on 24 May 2010 14:40 On Mon, May 24, 2010 at 6:27 AM, Periyasamy Ramachandiran <periyasamy(a)riverstonetech.com> wrote: > 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
From: Periyasamy Ramachandiran on 4 Jun 2010 05:18 unknown wrote: > On Mon, May 24, 2010 at 6:27 AM, Periyasamy Ramachandiran > <periyasamy(a)riverstonetech.com> wrote: >> 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 Hi, Great!. It worked for me. Thanks, Periyasamy.R -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: IPAddress: new IP manipulation library Next: WSDL with network credential |