Module: Devise::LdapAdapter

Defined in:
lib/devise_ldap_authenticatable/ldap_adapter.rb

Defined Under Namespace

Classes: LdapConnect

Class Method Summary collapse

Class Method Details

.get_attribute_to_compare(login) ⇒ Object

Get the value to be compared with the db field for authenticating. Application Specific Change



58
59
60
61
62
63
64
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 58

def self.get_attribute_to_compare()
  options = {:login => , 
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}
  resource = LdapConnect.new(options)
  resource.attribute_to_compare
end

.get_dn(login) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 36

def self.get_dn()
  options = {:login => , 
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}
  resource = LdapConnect.new(options)
  resource.dn
end

.get_groups(login) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 27

def self.get_groups()
  options = {:login => , 
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}

  ldap = LdapConnect.new(options)
  ldap.user_groups
end

.get_persistant_attributes(login) ⇒ Object

Get the values of the attributes to be synched on to the Applications db. Application Specific Change



47
48
49
50
51
52
53
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 47

def self.get_persistant_attributes()
  options = {:login => , 
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}
  resource = LdapConnect.new(options)
  resource.persistant_attributes
end

.update_password(login, new_password) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 17

def self.update_password(, new_password)
  options = {:login => ,
             :new_password => new_password,
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}
             
  resource = LdapConnect.new(options)
  resource.change_password! if new_password.present? 
end

.valid_credentials?(login, password_plaintext) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 7

def self.valid_credentials?(, password_plaintext)
  options = {:login => , 
             :password => password_plaintext, 
             :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
             :admin => ::Devise.ldap_use_admin_to_bind}
             
  resource = LdapConnect.new(options)
  resource.authorized?
end