Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix(Token): make new scope future compatible
- "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
commit 4ec174197f3ee47631193f7941ef656ce6b06be1
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 @@ -310,6 +310,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 @@ -200,7 +200,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