Module: Devise::LdapAdapter
- Defined in:
- lib/devise_ldap_authenticatable/ldap_adapter.rb
Defined Under Namespace
Classes: LdapConnect
Class Method Summary collapse
- .get_dn(login) ⇒ Object
- .get_groups(login) ⇒ Object
- .get_ldap_entry(login) ⇒ Object
- .get_ldap_param(login, param) ⇒ Object
- .ldap_connect(login) ⇒ Object
- .set_ldap_param(login, param, new_value, password = nil) ⇒ Object
- .update_own_password(login, new_password, current_password) ⇒ Object
- .update_password(login, new_password) ⇒ Object
- .valid_credentials?(login, password_plaintext) ⇒ Boolean
- .valid_login?(login) ⇒ Boolean
Class Method Details
.get_dn(login) ⇒ Object
47 48 49 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 47 def self.get_dn(login) self.ldap_connect(login).dn end |
.get_groups(login) ⇒ Object
43 44 45 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 43 def self.get_groups(login) self.ldap_connect(login).user_groups end |
.get_ldap_entry(login) ⇒ Object
65 66 67 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 65 def self.get_ldap_entry(login) self.ldap_connect(login).search_for_login end |
.get_ldap_param(login, param) ⇒ Object
60 61 62 63 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 60 def self.get_ldap_param(login,param) resource = self.ldap_connect(login) resource.ldap_param_value(param) end |
.ldap_connect(login) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 31 def self.ldap_connect(login) = {:login => login, :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder, :admin => ::Devise.ldap_use_admin_to_bind} resource = LdapConnect.new() end |
.set_ldap_param(login, param, new_value, password = nil) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 51 def self.set_ldap_param(login, param, new_value, password = nil) = { :login => login, :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder, :password => password } resource = LdapConnect.new() resource.set_param(param, new_value) end |
.update_own_password(login, new_password, current_password) ⇒ Object
27 28 29 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 27 def self.update_own_password(login, new_password, current_password) set_ldap_param(login, :userpassword, new_password, current_password) 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(login, new_password) = {:login => login, :new_password => new_password, :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder, :admin => ::Devise.ldap_use_admin_to_bind} resource = LdapConnect.new() resource.change_password! if new_password.present? end |
.valid_credentials?(login, password_plaintext) ⇒ Boolean
7 8 9 10 11 12 13 14 15 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 7 def self.valid_credentials?(login, password_plaintext) = {:login => login, :password => password_plaintext, :ldap_auth_username_builder => ::Devise.ldap_auth_username_builder, :admin => ::Devise.ldap_use_admin_to_bind} resource = LdapConnect.new() resource. end |
.valid_login?(login) ⇒ Boolean
39 40 41 |
# File 'lib/devise_ldap_authenticatable/ldap_adapter.rb', line 39 def self.valid_login?(login) self.ldap_connect(login).valid_login? end |