-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix user_ldap login on master by using userSession to retrieve the user object #28450
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes user logins using the user_ldap app.
|
Maybe the |
|
Sorry, obviously I should have run the tests locally before doing the PR. |
|
IMHO, it makes sense to get the user who is logged in from the userSession instead of userManager. 👍 |
core/Controller/LoginController.php
Outdated
| } | ||
| /* @var $loginResult IUser */ | ||
| $loginResult = $this->userManager->get($user); | ||
| $loginResult = $this->userSession->getUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind changing the variable name? That's not a login result, nor it doesn't make sense to get a UID from a login result.
|
I wonder if there is something else behind that which is causing the problem. Anyway, I don't have a strong opposition for this change. |
|
It is related to #28206 . Recently I added failed login hook and move login validation logic to userSession instead of userManager. Before my commit, $loginResult variable was assigning by userManager's checkPassword method as User object on success case. Now, the password verification is done during into userSession's login method. Therefore, $loginResult variable should assign from userSession's getUser method in my POV. |
|
It may be better to change the variable name also. |
|
Thank you for looking into this @karakayasemi @jvillafanez! I changed the variable name to |
|
Changes are good 👍 Maybe @DeepDiver1975 or @PVince81 can kick jenkins. |
|
kicked |
|
|
kicked Jenkins again... |
|
@jvillafanez can you backport this to stable10 ? |
|
(assuming the problem exists on stable10 too) |
|
It is related to #28206. It was only merged to master. stable10 was not affected. No need to backport. |
|
@karakayasemi thanks for the info. I added a note here to link the tickets #28206 (comment). Now considering that master will not be released any time soon, we might want to backport both #28206 and #28450 to stable10. @DeepDiver1975 thoughts ? |
|
Yes - please backport them all @karakayasemi - THX |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
After having successfully validated the user credentials, the
tryLoginfunction callsto get hold of the user object. Here,
$useris the login name provided by the user on login.This causes a problem if the
user_ldapapp is used because the UID does not correspond to the login name given by the user in that case. Rather, the UID is the UUID of the LDAP entry (e.g.7c1247da-d30e-1036-8350-cd5127ce8b3b). Consequently,userManager->get($user)does not find the user and returnsnull, which causes an exception when$loginResult->getUID()is called in the next line.This PR works around this problem by retrieving the user object via
userSession->getUserinstead. However, I don't know much about the ownCloud codebase, so please let me know if there is anything wrong with this approach :-)Related Issue
#28449
Motivation and Context
It fixes user login when using the user_ldap app.
How Has This Been Tested?
I tested the login manually.
Screenshots (if appropriate):
Types of changes
Checklist: