-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Apptoken v3: imrpove token handling on external password change #11390
Conversation
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.
Looks good so far! 🚀
@@ -338,4 +338,10 @@ private function decryptPassword(string $password, string $token): string { | |||
} | |||
} | |||
|
|||
public function markPasswordInvalid(IToken $token, string $tokenId) { | |||
//No need to mark as invalid. We just invalide default tokens | |||
$this->invalidateToken($tokenId); |
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.
You don't check the concrete class here …
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.
I should be consitent yes. However I do check it in the PublicKeyTokenProvider since we use a function that is only available on this function always works. Anyway let me be consistent ;)
|
||
$token->setPasswordInvalid(true); | ||
$this->mapper->update($token); | ||
return $token; |
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.
return value is neither in the interface nor does the manager pass it on
lib/private/User/Session.php
Outdated
@@ -694,12 +694,18 @@ private function checkTokenCredentials(IToken $dbToken, $token) { | |||
return true; | |||
} | |||
|
|||
if ($this->manager->checkPassword($dbToken->getLoginName(), $pwd) === false | |||
|| (!is_null($this->activeUser) && !$this->activeUser->isEnabled())) { | |||
// Invalidate tken if the user is no longer active |
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.
typo: "tken" -> "token"
@@ -922,5 +922,9 @@ public function updateSessionTokenPassword($password) { | |||
} | |||
} | |||
|
|||
public function updateTokens(string $uid, string $password) { |
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.
At some point we should discuss a refactoring of this user session class. This will soon be unmaintainable due to its complexity 🙈
ab9c5ec
to
0c7d5ee
Compare
@blizzz could you give this a test with LDAP?
|
Will do today. |
@rullzer tested, workz! |
000dae4
to
6477843
Compare
Ready for review :) |
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.
👍
$qb->select('*') | ||
->from('authtoken') | ||
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) | ||
->andWhere($qb->expr()->eq('password_invalid', $qb->createNamedParameter(true))) |
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.
better specify the type (bool) here
Signed-off-by: Roeland Jago Douma <[email protected]>
Signed-off-by: Roeland Jago Douma <[email protected]>
* On weblogin check if we have invalid public key tokens * If so update them all with the new token This ensures that your marked as invalid tokens work again if you once login on the web. Signed-off-by: Roeland Jago Douma <[email protected]>
Signed-off-by: Roeland Jago Douma <[email protected]>
6477843
to
19f84f7
Compare
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.
Tested and works 👍
Fixes #11043
Easiest to review per commit
Todo: