From e7e71b2fa7e2b139104e39d66ea819941e3dd330 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 13:39:09 +0530 Subject: [PATCH 01/12] SSO issue cleanup --- lib/Service/SSOService.php | 142 ++++++++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index ee17ac45..5858fbed 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -7,6 +7,8 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Db\TwoFactorMapper; use OCA\EcloudAccounts\Exception\SSOAdminAccessTokenException; use OCA\EcloudAccounts\Exception\SSOAdminAPIException; +use OCP\ICache; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; use OCP\IUserManager; @@ -27,6 +29,8 @@ class SSOService { private IFactory $l10nFactory; private IUserManager $userManager; private TwoFactorMapper $twoFactorMapper; + private ICacheFactory $cacheFactory; + private ICache $clientsCache; private string $mainDomain; private string $legacyDomain; @@ -34,8 +38,10 @@ class SSOService { private const ADMIN_TOKEN_ENDPOINT = '/auth/realms/master/protocol/openid-connect/token'; private const USERS_ENDPOINT = '/users'; private const CREDENTIALS_ENDPOINT = '/users/{USER_ID}/credentials'; + private const CLIENTS_CACHE_KEY = 'ecloud_accounts_sso_clients_list'; + private const CLIENTS_CACHE_TTL = 6 * 3600; // 6 hours - public function __construct($appName, IConfig $config, CurlService $curlService, ICrypto $crypto, IFactory $l10nFactory, IUserManager $userManager, TwoFactorMapper $twoFactorMapper, ILogger $logger) { + public function __construct($appName, IConfig $config, CurlService $curlService, ICrypto $crypto, IFactory $l10nFactory, IUserManager $userManager, TwoFactorMapper $twoFactorMapper, ILogger $logger, ICacheFactory $cacheFactory) { $this->appName = $appName; $this->config = $config; @@ -56,6 +62,8 @@ class SSOService { $this->l10nFactory = $l10nFactory; $this->userManager = $userManager; $this->twoFactorMapper = $twoFactorMapper; + $this->cacheFactory = $cacheFactory; + $this->clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_sso_clients'); $this->mainDomain = $this->config->getSystemValue("main_domain"); $this->legacyDomain = $this->config->getSystemValue("legacy_domain"); @@ -110,6 +118,138 @@ class SSOService { $this->logger->debug('logout calling SSO API with url: '. $url); $this->callSSOAPI($url, 'POST', [], 204); + + // Revoke offline sessions for all clients + $this->logger->debug('Starting offline session revocation for user: ' . $username); + try { + $this->revokeOfflineSessionsForUser(); + $this->logger->debug('Offline session revocation completed successfully for user: ' . $username); + } catch (\Exception $e) { + $this->logger->warning('Failed to revoke offline sessions: ' . $e->getMessage()); + // Don't throw the exception - offline session revocation is not critical for logout + } + } + + /** + * Revoke all offline sessions for the current user in Keycloak + */ + private function revokeOfflineSessionsForUser(): void { + $this->logger->debug('Starting offline session revocation process for user ID: ' . $this->currentUserId); + try { + $clients = $this->getClientsForRealm(); + if (empty($clients)) { + $this->logger->debug('No clients found for offline session revocation'); + return; + } + + $this->logger->debug('Found ' . count($clients) . ' clients to process for offline session revocation'); + foreach ($clients as $client) { + try { + $this->revokeOfflineSessionsForClient($client); + } catch (\Exception $e) { + $this->logger->warning('Failed to revoke offline sessions for client: ' . (isset($client['id']) ? $client['id'] : 'unknown') . ' - ' . $e->getMessage()); + // Continue with other clients even if one fails + } + } + $this->logger->debug('Offline session revocation process completed for user ID: ' . $this->currentUserId); + } catch (\Exception $e) { + $this->logger->warning('Failed to get clients for offline session revocation: ' . $e->getMessage()); + } + } + + /** + * Get all clients for the current realm with caching + */ + private function getClientsForRealm(): array { + // Try to get cached clients + $cachedClients = $this->clientsCache->get(self::CLIENTS_CACHE_KEY); + if ($cachedClients !== null) { + $this->logger->debug('Returning cached clients from distributed cache'); + return $cachedClients; + } + + // Fetch fresh clients from API + $clientsUrl = $this->ssoConfig['admin_rest_api_url'] . '/clients'; + + try { + $clients = $this->callSSOAPI($clientsUrl, 'GET'); + + if (!is_array($clients)) { + $this->logger->error('Could not fetch clients for offline session revocation.'); + return []; + } + + // Cache the clients for 6 hours + $this->clientsCache->set(self::CLIENTS_CACHE_KEY, $clients, self::CLIENTS_CACHE_TTL); + $this->logger->debug('Cached ' . count($clients) . ' clients in distributed cache for 6 hours'); + + return $clients; + } catch (\Exception $e) { + $this->logger->error('Failed to fetch clients for offline session revocation: ' . $e->getMessage()); + return []; + } + } + + /** + * Revoke offline sessions for a specific client + */ + private function revokeOfflineSessionsForClient(array $client): void { + if (!isset($client['id'])) { + return; + } + + $clientUUID = $client['id']; + + // Get offline sessions for this client and user + $offlineSessions = $this->getOfflineSessionsForClient($clientUUID); + if (empty($offlineSessions)) { + $this->logger->debug('No offline sessions found for client: ' . $clientUUID); + return; + } + + // Delete each offline session individually + foreach ($offlineSessions as $session) { + $this->deleteOfflineSession($session); + } + } + + /** + * Get offline sessions for a specific client and user + */ + private function getOfflineSessionsForClient(string $clientUUID): array { + $offlineSessionsUrl = $this->ssoConfig['admin_rest_api_url'] . self::USERS_ENDPOINT . '/' . $this->currentUserId . '/offline-sessions/' . $clientUUID . '?isOffline=true'; + + try { + $offlineSessions = $this->callSSOAPI($offlineSessionsUrl, 'GET'); + + if (!is_array($offlineSessions)) { + return []; + } + + return $offlineSessions; + } catch (\Exception $e) { + $this->logger->error('Failed to fetch offline sessions for client ' . $clientUUID . ': ' . $e->getMessage()); + return []; + } + } + + /** + * Delete a specific offline session + */ + private function deleteOfflineSession(array $session): void { + if (!isset($session['id'])) { + return; + } + + $sessionId = $session['id']; + $deleteSessionUrl = $this->ssoConfig['admin_rest_api_url'] . '/sessions/' . $sessionId . '?isOffline=true'; + + try { + $this->logger->info('Deleting offline session: ' . $sessionId); + $this->callSSOAPI($deleteSessionUrl, 'DELETE', [], 204); + } catch (\Exception $e) { + $this->logger->error('Failed to delete offline session ' . $sessionId . ': ' . $e->getMessage()); + } } public function handle2FAStateChange(bool $enabled, string $username) : void { -- GitLab From eb2862b660191e4b791239661e61ae3ab397135a Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 13:55:35 +0530 Subject: [PATCH 02/12] handled php conversion --- lib/Service/SSOService.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 5858fbed..f5ac36e4 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -38,7 +38,6 @@ class SSOService { private const ADMIN_TOKEN_ENDPOINT = '/auth/realms/master/protocol/openid-connect/token'; private const USERS_ENDPOINT = '/users'; private const CREDENTIALS_ENDPOINT = '/users/{USER_ID}/credentials'; - private const CLIENTS_CACHE_KEY = 'ecloud_accounts_sso_clients_list'; private const CLIENTS_CACHE_TTL = 6 * 3600; // 6 hours public function __construct($appName, IConfig $config, CurlService $curlService, ICrypto $crypto, IFactory $l10nFactory, IUserManager $userManager, TwoFactorMapper $twoFactorMapper, ILogger $logger, ICacheFactory $cacheFactory) { @@ -161,16 +160,20 @@ class SSOService { * Get all clients for the current realm with caching */ private function getClientsForRealm(): array { + // Create unique cache key based on URL (no parameters for this endpoint) + $clientsUrl = $this->ssoConfig['admin_rest_api_url'] . '/clients'; + $cacheKey = "{$clientsUrl}|no_params|no_keys"; + // Try to get cached clients - $cachedClients = $this->clientsCache->get(self::CLIENTS_CACHE_KEY); + $cachedClients = $this->clientsCache->get($cacheKey); if ($cachedClients !== null) { - $this->logger->debug('Returning cached clients from distributed cache'); - return $cachedClients; + $clients = json_decode($cachedClients, true); + if (is_array($clients)) { + $this->logger->debug('Returning cached clients from distributed cache'); + return $clients; + } } - // Fetch fresh clients from API - $clientsUrl = $this->ssoConfig['admin_rest_api_url'] . '/clients'; - try { $clients = $this->callSSOAPI($clientsUrl, 'GET'); @@ -179,8 +182,9 @@ class SSOService { return []; } - // Cache the clients for 6 hours - $this->clientsCache->set(self::CLIENTS_CACHE_KEY, $clients, self::CLIENTS_CACHE_TTL); + // Cache the clients for 6 hours (serialize to JSON string) + $clientsJson = json_encode($clients); + $this->clientsCache->set($cacheKey, $clientsJson, self::CLIENTS_CACHE_TTL); $this->logger->debug('Cached ' . count($clients) . ' clients in distributed cache for 6 hours'); return $clients; -- GitLab From 017a818daca8eb601342f3d067a28889342243cd Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 13:56:36 +0530 Subject: [PATCH 03/12] 24 hours for cache --- lib/Service/SSOService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index f5ac36e4..3a2816b1 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -38,7 +38,7 @@ class SSOService { private const ADMIN_TOKEN_ENDPOINT = '/auth/realms/master/protocol/openid-connect/token'; private const USERS_ENDPOINT = '/users'; private const CREDENTIALS_ENDPOINT = '/users/{USER_ID}/credentials'; - private const CLIENTS_CACHE_TTL = 6 * 3600; // 6 hours + private const CLIENTS_CACHE_TTL = 24 * 3600; // 24 hours public function __construct($appName, IConfig $config, CurlService $curlService, ICrypto $crypto, IFactory $l10nFactory, IUserManager $userManager, TwoFactorMapper $twoFactorMapper, ILogger $logger, ICacheFactory $cacheFactory) { $this->appName = $appName; -- GitLab From 5af6ec62318564e36d225f63370e6b1f019f431d Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:01:43 +0530 Subject: [PATCH 04/12] cleanup logs --- lib/Service/SSOService.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 3a2816b1..e290e96c 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -119,13 +119,10 @@ class SSOService { $this->callSSOAPI($url, 'POST', [], 204); // Revoke offline sessions for all clients - $this->logger->debug('Starting offline session revocation for user: ' . $username); try { $this->revokeOfflineSessionsForUser(); - $this->logger->debug('Offline session revocation completed successfully for user: ' . $username); } catch (\Exception $e) { $this->logger->warning('Failed to revoke offline sessions: ' . $e->getMessage()); - // Don't throw the exception - offline session revocation is not critical for logout } } @@ -133,15 +130,12 @@ class SSOService { * Revoke all offline sessions for the current user in Keycloak */ private function revokeOfflineSessionsForUser(): void { - $this->logger->debug('Starting offline session revocation process for user ID: ' . $this->currentUserId); try { $clients = $this->getClientsForRealm(); if (empty($clients)) { - $this->logger->debug('No clients found for offline session revocation'); return; } - $this->logger->debug('Found ' . count($clients) . ' clients to process for offline session revocation'); foreach ($clients as $client) { try { $this->revokeOfflineSessionsForClient($client); @@ -150,7 +144,6 @@ class SSOService { // Continue with other clients even if one fails } } - $this->logger->debug('Offline session revocation process completed for user ID: ' . $this->currentUserId); } catch (\Exception $e) { $this->logger->warning('Failed to get clients for offline session revocation: ' . $e->getMessage()); } @@ -182,10 +175,9 @@ class SSOService { return []; } - // Cache the clients for 6 hours (serialize to JSON string) + // Cache the clients for 24 hours (converted to JSON string) $clientsJson = json_encode($clients); $this->clientsCache->set($cacheKey, $clientsJson, self::CLIENTS_CACHE_TTL); - $this->logger->debug('Cached ' . count($clients) . ' clients in distributed cache for 6 hours'); return $clients; } catch (\Exception $e) { @@ -249,7 +241,6 @@ class SSOService { $deleteSessionUrl = $this->ssoConfig['admin_rest_api_url'] . '/sessions/' . $sessionId . '?isOffline=true'; try { - $this->logger->info('Deleting offline session: ' . $sessionId); $this->callSSOAPI($deleteSessionUrl, 'DELETE', [], 204); } catch (\Exception $e) { $this->logger->error('Failed to delete offline session ' . $sessionId . ': ' . $e->getMessage()); -- GitLab From 030d2d3e14b57dc03743ae2892cbf26810f3eb70 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:17:04 +0530 Subject: [PATCH 05/12] added array for clientsCache --- lib/Service/SSOService.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index e290e96c..c8d76090 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -160,11 +160,8 @@ class SSOService { // Try to get cached clients $cachedClients = $this->clientsCache->get($cacheKey); if ($cachedClients !== null) { - $clients = json_decode($cachedClients, true); - if (is_array($clients)) { - $this->logger->debug('Returning cached clients from distributed cache'); - return $clients; - } + $this->logger->debug('Returning cached clients from distributed cache'); + return $cachedClients; } try { @@ -175,9 +172,7 @@ class SSOService { return []; } - // Cache the clients for 24 hours (converted to JSON string) - $clientsJson = json_encode($clients); - $this->clientsCache->set($cacheKey, $clientsJson, self::CLIENTS_CACHE_TTL); + $this->clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); return $clients; } catch (\Exception $e) { -- GitLab From 14b5af36ad0001fe4bf69fda224be050ce569de7 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:29:47 +0530 Subject: [PATCH 06/12] ecloud_accounts_realm_clients create distributed changes --- lib/Service/SSOService.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index c8d76090..47b006c5 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -30,7 +30,6 @@ class SSOService { private IUserManager $userManager; private TwoFactorMapper $twoFactorMapper; private ICacheFactory $cacheFactory; - private ICache $clientsCache; private string $mainDomain; private string $legacyDomain; @@ -62,7 +61,6 @@ class SSOService { $this->userManager = $userManager; $this->twoFactorMapper = $twoFactorMapper; $this->cacheFactory = $cacheFactory; - $this->clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_sso_clients'); $this->mainDomain = $this->config->getSystemValue("main_domain"); $this->legacyDomain = $this->config->getSystemValue("legacy_domain"); @@ -158,7 +156,8 @@ class SSOService { $cacheKey = "{$clientsUrl}|no_params|no_keys"; // Try to get cached clients - $cachedClients = $this->clientsCache->get($cacheKey); + $clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients'); + $cachedClients = $clientsCache->get($cacheKey); if ($cachedClients !== null) { $this->logger->debug('Returning cached clients from distributed cache'); return $cachedClients; @@ -172,7 +171,7 @@ class SSOService { return []; } - $this->clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); + $clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); return $clients; } catch (\Exception $e) { -- GitLab From 088719a7aefee6229241d618f123360a15c20bd0 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:31:32 +0530 Subject: [PATCH 07/12] removed icache --- lib/Service/SSOService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 47b006c5..38faaa11 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -7,7 +7,6 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Db\TwoFactorMapper; use OCA\EcloudAccounts\Exception\SSOAdminAccessTokenException; use OCA\EcloudAccounts\Exception\SSOAdminAPIException; -use OCP\ICache; use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; -- GitLab From d3e70a015938ee1a9484152494d51f5da9595003 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:36:49 +0530 Subject: [PATCH 08/12] clicnetCache moved at construct --- lib/Service/SSOService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 38faaa11..013894b1 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -29,6 +29,7 @@ class SSOService { private IUserManager $userManager; private TwoFactorMapper $twoFactorMapper; private ICacheFactory $cacheFactory; + private ICache $clientsCache; private string $mainDomain; private string $legacyDomain; @@ -60,6 +61,7 @@ class SSOService { $this->userManager = $userManager; $this->twoFactorMapper = $twoFactorMapper; $this->cacheFactory = $cacheFactory; + $this->clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients'); $this->mainDomain = $this->config->getSystemValue("main_domain"); $this->legacyDomain = $this->config->getSystemValue("legacy_domain"); @@ -155,8 +157,7 @@ class SSOService { $cacheKey = "{$clientsUrl}|no_params|no_keys"; // Try to get cached clients - $clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients'); - $cachedClients = $clientsCache->get($cacheKey); + $cachedClients = $this->clientsCache->get($cacheKey); if ($cachedClients !== null) { $this->logger->debug('Returning cached clients from distributed cache'); return $cachedClients; @@ -170,7 +171,7 @@ class SSOService { return []; } - $clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); + $this->clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); return $clients; } catch (\Exception $e) { -- GitLab From 97ac0a713e301ee09e15d0c4cb5c830be066e8d1 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:40:18 +0530 Subject: [PATCH 09/12] added cache --- lib/Service/SSOService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 013894b1..2d027eb0 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -7,7 +7,7 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Db\TwoFactorMapper; use OCA\EcloudAccounts\Exception\SSOAdminAccessTokenException; use OCA\EcloudAccounts\Exception\SSOAdminAPIException; -use OCP\ICacheFactory; +use OCP\ICache; use OCP\IConfig; use OCP\ILogger; use OCP\IUserManager; @@ -28,7 +28,7 @@ class SSOService { private IFactory $l10nFactory; private IUserManager $userManager; private TwoFactorMapper $twoFactorMapper; - private ICacheFactory $cacheFactory; + private ICache $clientsCache; private string $mainDomain; @@ -60,8 +60,8 @@ class SSOService { $this->l10nFactory = $l10nFactory; $this->userManager = $userManager; $this->twoFactorMapper = $twoFactorMapper; - $this->cacheFactory = $cacheFactory; - $this->clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients'); + + $this->clientsCache = $cacheFactory->createDistributed('ecloud_accounts_realm_clients'); $this->mainDomain = $this->config->getSystemValue("main_domain"); $this->legacyDomain = $this->config->getSystemValue("legacy_domain"); -- GitLab From 9e7bc9801a722b4e49d06a1da3797a7f556ee3b1 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:41:36 +0530 Subject: [PATCH 10/12] declaration reverted at function --- lib/Service/SSOService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 2d027eb0..47b006c5 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -8,6 +8,7 @@ use OCA\EcloudAccounts\Db\TwoFactorMapper; use OCA\EcloudAccounts\Exception\SSOAdminAccessTokenException; use OCA\EcloudAccounts\Exception\SSOAdminAPIException; use OCP\ICache; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; use OCP\IUserManager; @@ -28,8 +29,7 @@ class SSOService { private IFactory $l10nFactory; private IUserManager $userManager; private TwoFactorMapper $twoFactorMapper; - - private ICache $clientsCache; + private ICacheFactory $cacheFactory; private string $mainDomain; private string $legacyDomain; @@ -60,8 +60,7 @@ class SSOService { $this->l10nFactory = $l10nFactory; $this->userManager = $userManager; $this->twoFactorMapper = $twoFactorMapper; - - $this->clientsCache = $cacheFactory->createDistributed('ecloud_accounts_realm_clients'); + $this->cacheFactory = $cacheFactory; $this->mainDomain = $this->config->getSystemValue("main_domain"); $this->legacyDomain = $this->config->getSystemValue("legacy_domain"); @@ -157,7 +156,8 @@ class SSOService { $cacheKey = "{$clientsUrl}|no_params|no_keys"; // Try to get cached clients - $cachedClients = $this->clientsCache->get($cacheKey); + $clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients'); + $cachedClients = $clientsCache->get($cacheKey); if ($cachedClients !== null) { $this->logger->debug('Returning cached clients from distributed cache'); return $cachedClients; @@ -171,7 +171,7 @@ class SSOService { return []; } - $this->clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); + $clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL); return $clients; } catch (\Exception $e) { -- GitLab From ca067a3f85c5c6fbe720d5662a03f9756859ebe0 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 14:43:04 +0530 Subject: [PATCH 11/12] 6 hours --- lib/Service/SSOService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 47b006c5..570b5b31 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -37,7 +37,7 @@ class SSOService { private const ADMIN_TOKEN_ENDPOINT = '/auth/realms/master/protocol/openid-connect/token'; private const USERS_ENDPOINT = '/users'; private const CREDENTIALS_ENDPOINT = '/users/{USER_ID}/credentials'; - private const CLIENTS_CACHE_TTL = 24 * 3600; // 24 hours + private const CLIENTS_CACHE_TTL = 6 * 3600; // 6 hours public function __construct($appName, IConfig $config, CurlService $curlService, ICrypto $crypto, IFactory $l10nFactory, IUserManager $userManager, TwoFactorMapper $twoFactorMapper, ILogger $logger, ICacheFactory $cacheFactory) { $this->appName = $appName; -- GitLab From c533064ab348452a47c9c62ae8cf6c19b88ba884 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 29 Jul 2025 15:12:50 +0530 Subject: [PATCH 12/12] php lint' --- lib/Service/SSOService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Service/SSOService.php b/lib/Service/SSOService.php index 570b5b31..03acaf21 100644 --- a/lib/Service/SSOService.php +++ b/lib/Service/SSOService.php @@ -7,7 +7,6 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Db\TwoFactorMapper; use OCA\EcloudAccounts\Exception\SSOAdminAccessTokenException; use OCA\EcloudAccounts\Exception\SSOAdminAPIException; -use OCP\ICache; use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; -- GitLab