ui unauth fix

This commit is contained in:
CITE\spapacharalampous 2024-07-16 12:09:13 +03:00
parent 6173f088ed
commit 2283f95a5f
2 changed files with 5 additions and 0 deletions

View File

@ -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(['/']);
});

View File

@ -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<string>, tenantCode: string, httpParams?: Object): Observable<boolean> {
return observable.pipe(
map((x) => this.currentAuthenticationToken(x)),