Skip to content

Commit

Permalink
fix(Token): make new scope future compatible
Browse files Browse the repository at this point in the history
- "password-unconfirmable" is the effective name for 30, but a draft
  name was backported.

Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Jun 12, 2024
1 parent d4360a1 commit e58f635
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function beforeController($controller, $methodName) {
return;
}
$scope = $token->getScopeAsArray();
if (isset($scope['sso-based-login']) && $scope['sso-based-login'] === true) {
if (isset($scope['password-unconfirmable']) && $scope['password-unconfirmable'] === true) {
// Users logging in from SSO backends cannot confirm their password by design
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Template/JSConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,6 @@ protected function canUserValidatePassword(): bool {
return true;
}
$scope = $token->getScopeAsArray();
return !isset($scope['sso-based-login']) || $scope['sso-based-login'] === false;
return !isset($scope['password-unconfirmable']) || $scope['password-unconfirmable'] === false;
}
}
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
if (empty($password)) {
$tokenProvider = \OC::$server->get(IProvider::class);
$token = $tokenProvider->getToken($userSession->getSession()->getId());
$token->setScope(['sso-based-login' => true]);
$token->setScope(['password-unconfirmable' => true]);
$tokenProvider->updateToken($token);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function testSSO() {

$token = $this->createMock(IToken::class);
$token->method('getScopeAsArray')
->willReturn(['sso-based-login' => true]);
->willReturn(['password-unconfirmable' => true]);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
Expand Down

0 comments on commit e58f635

Please sign in to comment.