Class: LeveretAuth::Strategies::LdapStrategy
Class Method Summary
collapse
Instance Method Summary
collapse
config, #initialize
Class Method Details
.client ⇒ Object
9
10
11
|
# File 'lib/leveret_auth/strategies/ldap_strategy.rb', line 9
def client
@client ||= Ldap::Connection.new(config)
end
|
13
14
15
|
# File 'lib/leveret_auth/strategies/ldap_strategy.rb', line 13
def configure(configuration)
@config = Ldap::Configuration.new(configuration)
end
|
Instance Method Details
#authenticate! ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/leveret_auth/strategies/ldap_strategy.rb', line 18
def authenticate!
entrys = client.search(@email)
raise Errors::InvalidCredential if entrys.nil?
verified_entry = entrys.find { |entry| client.bind_as(entry.dn, @password) }
raise Errors::InvalidCredential if verified_entry.nil?
user_model.setup_user_from_third_party(uid: verified_entry.dn,
provider: 'ldap',
email: @email)
end
|