class User < ActiveLdap::Base ldap_mapping :dn_attribute =>"uid" def self.authenticate(login, password) return nil if login.blank? || password.blank? u = find(:all, login).first # need to get the salt u && u.authenticated?(password) ? u : nil end def authenticated?(password) self.userPassword == password and Group.tecnology.include? self.uid end end