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

Instance Method Details

#in_ldap_group?(group_name, group_attribute = LdapAdapter::DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/devise_ldap_authenticatable/model.rb', line 24

def in_ldap_group?(group_name, group_attribute = LdapAdapter::DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY)
  Devise::LdapAdapter.in_ldap_group?(, group_name, group_attribute)
end

#ldap_dnObject



28
29
30
# File 'lib/devise_ldap_authenticatable/model.rb', line 28

def ldap_dn
  Devise::LdapAdapter.get_dn()
end

#ldap_get_param(login_with, param) ⇒ Object



32
33
34
# File 'lib/devise_ldap_authenticatable/model.rb', line 32

def ldap_get_param(, param)
  Devise::LdapAdapter.get_ldap_param(,param)
end

#ldap_groupsObject



20
21
22
# File 'lib/devise_ldap_authenticatable/model.rb', line 20

def ldap_groups
  Devise::LdapAdapter.get_groups()
end

#login_withObject



15
16
17
18
# File 'lib/devise_ldap_authenticatable/model.rb', line 15

def 
  @login_with ||= Devise.mappings[self.class.to_s.underscore.to_sym].to.authentication_keys.first
  self[@login_with]
end