Created
October 7, 2008 20:43
-
-
Save azisaka/15381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
host: 192.168.0.1 | |
port: 389 | |
base: dc=gaiz,dc=com,dc=br | |
bind_dn: cn=admin,dc=gaiz,dc=com,dc=br | |
password: gaiz | |
test: | |
host: 127.0.0.1 | |
port: 389 | |
base: dc=test,dc=local,dc=net | |
bind_dn: cn=admin,dc=local,dc=net | |
password: secret | |
production: | |
host: 127.0.0.1 | |
port: 389 | |
method: :tls | |
base: dc=production,dc=local,dc=net | |
bind_dn: cn=admin,dc=local,dc=net | |
password: secret | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment