From 2283f95a5f2c69f16f5e31f8acfffbd5f3374a65 Mon Sep 17 00:00:00 2001 From: "CITE\\spapacharalampous" Date: Tue, 16 Jul 2024 12:09:13 +0300 Subject: [PATCH] ui unauth fix --- frontend/src/app/app.module.ts | 2 ++ frontend/src/app/core/services/auth/auth.service.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index b8684b288..a1a8cadd4 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -111,6 +111,8 @@ export function InstallationConfigurationFactory(appConfig: ConfigurationService const tenantCode = tenantHandlingService.extractTenantCodeFromUrlPath(window.location.pathname) ?? authService.selectedTenant() ?? 'default'; const token = keycloak.getToken(); return authService.prepareAuthRequest(from(token), tenantCode, { params }).toPromise().catch(error => { + if (!authService.isKeycloakLoggedIn()) return; + authService.onAuthenticateError(error); router.navigate(['/']); }); diff --git a/frontend/src/app/core/services/auth/auth.service.ts b/frontend/src/app/core/services/auth/auth.service.ts index 821b82996..284ad84eb 100644 --- a/frontend/src/app/core/services/auth/auth.service.ts +++ b/frontend/src/app/core/services/auth/auth.service.ts @@ -167,6 +167,9 @@ export class AuthService extends BaseService { public isLoggedIn(): boolean { return this.authState(); } + public isKeycloakLoggedIn(): boolean { + return this.keycloakService.isLoggedIn(); + } public prepareAuthRequest(observable: Observable, tenantCode: string, httpParams?: Object): Observable { return observable.pipe( map((x) => this.currentAuthenticationToken(x)),