Skip to content

Commit

Permalink
Patch token invalidation when OpenId COnnect is used, nextcloud#27886
Browse files Browse the repository at this point in the history
We observer token invalidations random for OpenId Connect users and early apply the fix for
nextcloud#27886

Signed-off-by: Bernd.Rederlechner@t-systems.com <bernd.rederlechner@t-systems.com>
  • Loading branch information
tsdicloud authored and ilya.dokshukin@iits-consulting.de committed Oct 18, 2021
1 parent 3641523 commit ba67e10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/private/Authentication/Listeners/UserLoggedInListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public function handle(Event $event): void {
return;
}

// prevent setting an empty pw as result of pw-less-login
if ($event->getPassword() === '') {
return;
}

// If this is already a token login there is nothing to do
if ($event->isTokenLogin()) {
return;
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Authentication/Token/PublicKeyTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ public function markPasswordInvalid(IToken $token, string $tokenId) {
public function updatePasswords(string $uid, string $password) {
$this->cache->clear();

// prevent setting an empty pw as result of pw-less-login
if ($password === '') {
return;
}

// Update the password for all tokens
$tokens = $this->mapper->getTokenByUser($uid);
foreach ($tokens as $t) {
Expand Down

0 comments on commit ba67e10

Please sign in to comment.