Module: Minnie::User::Ldap::ClassMethods
- Defined in:
- lib/minnie-ldap/user/ldap.rb
Instance Method Summary collapse
- #authenticate(username, password, domain = 'corp.ads') ⇒ Object
- #bind(username, password, domain) ⇒ Object
- #hi ⇒ Object
Instance Method Details
#authenticate(username, password, domain = 'corp.ads') ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/minnie-ldap/user/ldap.rb', line 12 def authenticate(username, password, domain = 'corp.ads') if bind(username, password, domain) return find_or_create_by_username username else return nil end end |
#bind(username, password, domain) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/minnie-ldap/user/ldap.rb', line 20 def bind(username, password, domain) ::Net::LDAP.new( :auth => { :method => :simple, :username => "#{username}@#{domain}", :password => password }, :encryption => :simple_tls, :base => domain.split('.').map {|dc| "dc=#{dc}"}.join(','), :host => domain, :port => '636' ).bind end |
#hi ⇒ Object
9 10 11 |
# File 'lib/minnie-ldap/user/ldap.rb', line 9 def hi return "hi" end |