Skip to content
Open
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
4 changes: 1 addition & 3 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
['name' => 'login#code', 'url' => '/code', 'verb' => 'GET'],
['name' => 'login#singleLogoutService', 'url' => '/sls', 'verb' => 'GET'],
['name' => 'login#backChannelLogout', 'url' => '/backchannel-logout/{providerIdentifier}', 'verb' => 'POST'],
['name' => 'login#telekomBackChannelLogout', 'url' => '/logout', 'verb' => 'POST'],

['name' => 'id4me#showLogin', 'url' => '/id4me', 'verb' => 'GET'],
['name' => 'id4me#login', 'url' => '/id4me', 'verb' => 'POST'],
Expand All @@ -31,8 +32,5 @@
['name' => 'Settings#setID4ME', 'url' => '/api/{apiVersion}/provider/id4me', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'Settings#getSupportedSettings', 'url' => '/api/{apiVersion}/supported-settings', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'Settings#setAdminConfig', 'url' => '/api/{apiVersion}/admin-config', 'verb' => 'POST', 'requirements' => $requirements],

['name' => 'ocsApi#createUser', 'url' => '/api/{apiVersion}/user', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'ocsApi#deleteUser', 'url' => '/api/{apiVersion}/user/{userId}', 'verb' => 'DELETE', 'requirements' => $requirements],
],
];
23 changes: 11 additions & 12 deletions lib/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -702,25 +702,14 @@ public function code(string $state = '', string $code = '', string $scope = '',
$this->eventDispatcher->dispatchTyped(new UserLoggedInEvent($user, $userId, null, false));
}

$storeLoginTokenEnabled = $this->appConfig->getValueString(Application::APP_ID, 'store_login_token', '0', lazy: true) === '1';
if ($storeLoginTokenEnabled) {
// store all token information for potential token exchange requests
$tokenData = array_merge(
$data,
['provider_id' => $providerId],
);
$this->tokenService->storeToken($tokenData);
}
$this->config->setUserValue($user->getUID(), Application::APP_ID, 'had_token_once', '1');

// Set last password confirm to the future as we don't have passwords to confirm against with SSO
$this->session->set('last-password-confirm', $this->timeFactory->getTime() + 4 * 365 * 24 * 3600);

// for backchannel logout
try {
$authToken = $this->authTokenProvider->getToken($this->session->getId());
$this->sessionMapper->createOrUpdateSession(
$idTokenPayload->sid ?? 'fallback-sid',
$idTokenPayload->{'urn:telekom.com:session_token'} ?? 'fallback-sid',
$idTokenPayload->sub ?? 'fallback-sub',
$idTokenPayload->iss ?? 'fallback-iss',
$authToken->getId(),
Expand Down Expand Up @@ -1099,4 +1088,14 @@ private function cleanupSessionState(string $sessionKeySuffix): void {
$this->session->remove(self::CODE_VERIFIER . $sessionKeySuffix);
$this->session->remove(self::TIMESTAMP . $sessionKeySuffix);
}

/**
* Backward compatible function for MagentaCLOUD to smoothly transition to new config
*/
#[PublicPage]
#[NoCSRFRequired]
#[BruteForceProtection(action: 'userOidcBackchannelLogout')]
public function telekomBackChannelLogout(string $logout_token = ''): JSONResponse {
return $this->backChannelLogout('Telekom', $logout_token);
}
}
Loading