module Devise::Models::LdapNorm::ClassMethods

Public Instance Methods

find_for_ldap_authentication(attributes={}) click to toggle source
# File lib/devise_ldap_norm/model.rb, line 110
def find_for_ldap_authentication(attributes={})
  auth_key = self.authentication_keys.first
  return nil unless attributes[auth_key].present?

  auth_key_value = (self.case_insensitive_keys || []).include?(auth_key) ? attributes[auth_key].downcase : attributes[auth_key]
        auth_key_value = (self.strip_whitespace_keys || []).include?(auth_key) ? auth_key_value.strip : auth_key_value
  auth_key_value.gsub! /[^-\w.@]/i, ''

  resource = new(SecureRandom.uuid)

  resource['remote_ip'] = attributes[:remote_ip]
  resource[auth_key] = auth_key_value
  resource.password = attributes[:password]

  resource
end
serialize_from_session(id, data={}) click to toggle source
# File lib/devise_ldap_norm/model.rb, line 102
def serialize_from_session(id, data={})
  self.new(id, data)
end
serialize_into_session(record) click to toggle source
# File lib/devise_ldap_norm/model.rb, line 106
def serialize_into_session(record)
  [record.id, record.data]
end
update_with_password(resource) click to toggle source
# File lib/devise_ldap_norm/model.rb, line 127
def update_with_password(resource)
  puts "UPDATE_WITH_PASSWORD: #{resource.inspect}"
end