Skip to content
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

Always renew apppasswords on login #25460

Merged
merged 1 commit into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/private/Authentication/Token/PublicKeyTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,6 @@ public function markPasswordInvalid(IToken $token, string $tokenId) {
public function updatePasswords(string $uid, string $password) {
$this->cache->clear();

if (!$this->mapper->hasExpiredTokens($uid)) {
// Nothing to do here
return;
}

// Update the password for all tokens
$tokens = $this->mapper->getTokenByUser($uid);
foreach ($tokens as $t) {
Expand Down
18 changes: 1 addition & 17 deletions tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,7 @@ public function testUpdatePasswords() {
IToken::PERMANENT_TOKEN,
IToken::REMEMBER);

$this->mapper->expects($this->once())
->method('hasExpiredTokens')
$this->mapper->method('hasExpiredTokens')
->with($uid)
->willReturn(true);
$this->mapper->expects($this->once())
Expand All @@ -564,19 +563,4 @@ public function testUpdatePasswords() {

$this->tokenProvider->updatePasswords($uid, 'bar2');
}

public function testUpdatePasswordsNotRequired() {
$uid = 'myUID';

$this->mapper->expects($this->once())
->method('hasExpiredTokens')
->with($uid)
->willReturn(false);
$this->mapper->expects($this->never())
->method('getTokenByUser');
$this->mapper->expects($this->never())
->method('update');

$this->tokenProvider->updatePasswords($uid, 'bar2');
}
}