class IRBTracker::LDAPLogin
Attributes
current_user[R]
Public Class Methods
authenticate(username, password)
click to toggle source
# 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
Private Class Methods
ldap_connection()
click to toggle source
# File lib/irb_tracker/ldap_login.rb, line 22 def ldap_connection conn = Net::LDAP.new( host: ENV['LDAP_HOST'], port: ENV['LDAP_PORT'], base: ENV['LDAP_BASE'], encryption: nil ) conn.auth ENV['LDAP_ADMIN_USER'], ENV['LDAP_ADMIN_PASSWORD'] return false unless conn.bind conn end