From 8265f87e026e4a8d0b010a42db37e45c285ba95a Mon Sep 17 00:00:00 2001 From: Roberto Callari <robertocallari89@gmail.com> Date: Mon, 22 Mar 2021 15:08:07 +0100 Subject: [PATCH] update --- src/app/@theme/components/header/header.component.html | 2 +- src/app/app-routing.module.ts | 2 +- src/app/auth/oidc/oidc.ts | 4 +--- src/app/auth/services/oidc-user-information.service.ts | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/@theme/components/header/header.component.html b/src/app/@theme/components/header/header.component.html index 41ff2ce6..4ebef159 100644 --- a/src/app/@theme/components/header/header.component.html +++ b/src/app/@theme/components/header/header.component.html @@ -29,7 +29,7 @@ nbContextMenuTag="user-menu" [onlyPicture]="userPictureOnly" [name]="user?.preferred_username" - [title]="user?.realm_access?.roles.join(' | ')" + [title]="user?.roles.join(' | ')" [picture]="'assets/images/default_user.png'"> </nb-user> </nb-action> diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 29b4acef..b95f008c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -11,7 +11,7 @@ export const routes: Routes = [ path: 'pages', loadChildren: () => import('./pages/pages.module') .then(m => m.PagesModule), - + canActivate: [AuthGuard] }, { path: 'auth', diff --git a/src/app/auth/oidc/oidc.ts b/src/app/auth/oidc/oidc.ts index 976b3b10..7598356c 100644 --- a/src/app/auth/oidc/oidc.ts +++ b/src/app/auth/oidc/oidc.ts @@ -13,9 +13,7 @@ export interface UserClaims { picture: string; sub: string; updated_at: string; - realm_access: { - roles: string[]; - } + roles: string[]; } diff --git a/src/app/auth/services/oidc-user-information.service.ts b/src/app/auth/services/oidc-user-information.service.ts index 814917ad..53a1f8c7 100644 --- a/src/app/auth/services/oidc-user-information.service.ts +++ b/src/app/auth/services/oidc-user-information.service.ts @@ -29,7 +29,7 @@ export class OidcUserInformationService { } getRole(): Observable<string[]> { - return this.user ? observableOf(this.user.realm_access.roles.map(role => role.toUpperCase())) : observableOf(['CITIZEN']); + return this.user ? observableOf(this.user.roles.map(role => role.toUpperCase())) : observableOf(['CITIZEN']); } getUser(): Observable<UserClaims> { -- GitLab