Class: IRBTracker::LDAPLogin

Inherits:
Object
  • Object
show all
Defined in:
lib/irb_tracker/ldap_login.rb

Overview

:nodoc:

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.current_userObject (readonly)

Returns the value of attribute current_user.



9
10
11
# File 'lib/irb_tracker/ldap_login.rb', line 9

def current_user
  @current_user
end

Class Method Details

.authenticate(username, password) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/irb_tracker/ldap_login.rb', line 11

def authenticate(username, password)
  @current_user = username
  conn = ldap_connection
  filter = Net::LDAP::Filter.eq('mail', username)
  conn.bind_as(filter: filter, password: password)
rescue StandardError
  false
end