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); } });