Feature #1913 » 1913_redmine_bind_as_user2.diff
| app/models/auth_source_ldap.rb 2010-12-13 10:57:06.000000000 -0500 | ||
|---|---|---|
|
|
||
|
def authenticate(login, password)
|
||
|
return nil if login.blank? || password.blank?
|
||
|
attrs = get_user_dn(login)
|
||
|
attrs = get_user_dn(login, password)
|
||
|
|
||
|
if attrs && attrs[:dn] && authenticate_dn(attrs[:dn], password)
|
||
|
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
|
||
| ... | ... | |
|
end
|
||
|
# Get the user's dn and any attributes for them, given their login
|
||
|
def get_user_dn(login)
|
||
|
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||
|
def get_user_dn(login, password)
|
||
|
if self.account.include? "$login" then
|
||
|
ldap_con = initialize_ldap_con(self.account.sub("$login", login), password)
|
||
|
else
|
||
|
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||
|
end
|
||
|
login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
|
||
|
object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
|
||
|
attrs = {}
|
||
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »