summaryrefslogtreecommitdiffstats
path: root/app/models/auth_source_ldap.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-01-22 17:53:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-01-22 17:53:33 +0000
commit667071917e822e454c40acb5256d7daeb58d3a3b (patch)
tree2812fb402987eb19d76529de55d859e75d961805 /app/models/auth_source_ldap.rb
parent3ffdc863dec492808e3f05c8bd0e0e4df44650d6 (diff)
downloadredmine-667071917e822e454c40acb5256d7daeb58d3a3b.tar.gz
redmine-667071917e822e454c40acb5256d7daeb58d3a3b.zip
Fixed that LDAP does not check the user and password when are defined in the method of authentication (#21674).
Patch by Helder Manuel Torres Vieira. git-svn-id: http://svn.redmine.org/redmine/trunk@15086 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/auth_source_ldap.rb')
-rw-r--r--app/models/auth_source_ldap.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index b18b657b0..6dda73d9f 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -56,11 +56,16 @@ class AuthSourceLdap < AuthSource
raise AuthSourceException.new(e.message)
end
- # test the connection to the LDAP
+ # Test the connection to the LDAP
def test_connection
with_timeout do
ldap_con = initialize_ldap_con(self.account, self.account_password)
ldap_con.open { }
+
+ if self.account.present? && self.account_password.present?
+ ldap_auth = authenticate_dn(self.account, self.account_password)
+ raise AuthSourceException.new(l(:error_ldap_bind_credentials)) if !ldap_auth
+ end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)