RED-4482: logout when session expires
This commit is contained in:
parent
e69c5be7b7
commit
4714beec30
@ -65,7 +65,15 @@ export class UserService extends EntitiesService<IUser, User> {
|
||||
const userId = (<{ sub: string }>decoded).sub;
|
||||
|
||||
const roles = this._keycloakService.getUserRoles(true).filter(role => role.startsWith('RED_'));
|
||||
const user = new User(await this._keycloakService.loadUserProfile(true), roles, userId);
|
||||
let profile;
|
||||
try {
|
||||
profile = await this._keycloakService.loadUserProfile(true);
|
||||
} catch (e) {
|
||||
await this._keycloakService.logout();
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
const user = new User(profile, roles, userId);
|
||||
this.replace(user);
|
||||
|
||||
this.#currentUser$.next(this.find(userId));
|
||||
|
||||
@ -5,7 +5,7 @@ export class GlobalErrorHandler extends ErrorHandler {
|
||||
handleError(error: Error): void {
|
||||
const chunkFailedMessage = /Loading chunk [\d]+ failed/;
|
||||
console.write(error);
|
||||
if (error.message?.includes('An error happened during access validation')) {
|
||||
if (error?.message?.includes('An error happened during access validation')) {
|
||||
console.log('User is not authorized to access this page');
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user