Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5af6ec62 authored by theronakpatel's avatar theronakpatel
Browse files

cleanup logs

parent 017a818d
Loading
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -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());