From 60bc4c1a10d29a70a81fea12d94b4e24f0bc2a8b Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Fri, 3 Mar 2023 08:40:12 +0100 Subject: [PATCH] Add some authguard debug loggin' --- projects/common/src/fm/services/auth-guard.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/common/src/fm/services/auth-guard.service.ts b/projects/common/src/fm/services/auth-guard.service.ts index b57c0bd..168f51e 100644 --- a/projects/common/src/fm/services/auth-guard.service.ts +++ b/projects/common/src/fm/services/auth-guard.service.ts @@ -47,15 +47,16 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild { const requiredRoleClaim = route.data.role; if (!requiredRoleClaim) { resolve(true); } const ownedClaims = this.oauthService.getIdentityClaims(); - if (!ownedClaims) { resolve(false); } + if (!ownedClaims) { console.debug("No owned claims"); resolve(false); } const ownedRoleClaims: string[] = ownedClaims['role']; - if (!ownedRoleClaims) { resolve(false); } + if (!ownedRoleClaims) { console.debug("No owned role claims"); resolve(false); } if (Array.isArray(ownedRoleClaims)) { - if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) { resolve(false); } + if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) { console.debug("No required role claim", ownedRoleClaims, requiredRoleClaim); resolve(false); } } else { - if (ownedRoleClaims !== requiredRoleClaim) { resolve(false); } + if (ownedRoleClaims !== requiredRoleClaim) { console.debug("No required role claim", ownedRoleClaims, requiredRoleClaim); resolve(false); } } + console.debug("Has required role claim", requiredRoleClaim); resolve(true); } });