mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48901 from garethgreenaway/48665_auth_ldap_valid_token_failed_auth
[2018.3] fix to auth/ldap.py
This commit is contained in:
commit
e78fc0e0eb
1 changed files with 7 additions and 1 deletions
|
@ -283,9 +283,15 @@ def auth(username, password):
|
|||
log.error('LDAP authentication requires python-ldap module')
|
||||
return False
|
||||
|
||||
# If bind credentials are configured, use them instead of user's
|
||||
# If bind credentials are configured, verify that we receive a valid bind
|
||||
if _config('binddn', mandatory=False) and _config('bindpw', mandatory=False):
|
||||
bind = _bind_for_search(anonymous=_config('anonymous', mandatory=False))
|
||||
|
||||
# If username & password are not None, attempt to verify they are valid
|
||||
if bind and username and password:
|
||||
bind = _bind(username, password,
|
||||
anonymous=_config('auth_by_group_membership_only', mandatory=False)
|
||||
and _config('anonymous', mandatory=False))
|
||||
else:
|
||||
bind = _bind(username, password,
|
||||
anonymous=_config('auth_by_group_membership_only', mandatory=False)
|
||||
|
|
Loading…
Add table
Reference in a new issue