Module: Devise::Models::LdapAuthenticatable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_ldap_authenticatable/model.rb
Overview
LDAP Module, responsible for validating the user credentials via LDAP.
Examples:
User.authenticate('[email protected]', 'password123') # returns authenticated user or nil
User.find(1).valid_password?('password123') # returns true/false
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#clean_up_passwords ⇒ Object
FIXME find out how to get rid of this.
- #ldap_groups ⇒ Object
- #password=(new_password) ⇒ Object
-
#valid_ldap_authentication?(password) ⇒ Boolean
Checks if a resource is valid upon authentication.
Instance Method Details
#clean_up_passwords ⇒ Object
FIXME find out how to get rid of this.
29 30 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 29 def clean_up_passwords end |
#ldap_groups ⇒ Object
41 42 43 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 41 def ldap_groups Devise::LdapAdapter.get_groups(self.email) end |
#password=(new_password) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 20 def password=(new_password) @password = new_password if @password.present? Devise::LdapAdapter.update_password(self.email, password) if ::Devise.ldap_update_password end end |
#valid_ldap_authentication?(password) ⇒ Boolean
Checks if a resource is valid upon authentication.
33 34 35 36 37 38 39 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 33 def valid_ldap_authentication?(password) if Devise::LdapAdapter.valid_credentials?(self.email, password) return true else return false end end |