Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Security] fixes LDAP bind authentication using wrong username#21588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This fixes that the LDAP bind authentication ignores the uid_keyconfiguration of the LDAP user provider. It will now use the username ofthe User object instead of the token's username.
nicolas-grekas commentedFeb 14, 2017
ping@csarrazi |
fabpot commentedMar 1, 2017
@csarrazi Can you have a look at this PR? Thanks. |
csarrazi commentedMar 1, 2017
This has already been fixed in the Also, the reason why we use the token's username is because we should not rely on the user provider to provide the username. This works fine when you are using the LDAP user provider, but it may fail should you use another user provider. E.g. If you want to authenticate using your LDAP server, but rely on the database to store user-related information. |
fabpot commentedMar 1, 2017
@csarrazi Thanks for the quick feedback. So, can we close this one then? |
I'm trying to set up LDAP authentication where users can log in using their e-mail address, which should get resolved to the 'uid' field in the directory. After this the authentication should be based on this uid. I'm working against '389 directory server' as set up by a Kolab install. This does not seem to allow binding based on e.g. the mail field of a user.
The LDAP user provider is able to resolve the user. This is the (redacted) provider config I'm using:
I noticed the User object created by the LdapUserProvider is correctly set the the uid field of the user.
However, the LDAP Bind Authentication Provider does not use the username as provided by the user provider. Instead it uses the username as submitted in the token when binding. This means users cannot login.
The fix is to use
$user->getUsername()instead of$token->getUsername()incheckAuthentication(). This way the resolved username is used and the authentication works correctly.