Add some authguard debug loggin'
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
7b42ca252b
commit
60bc4c1a10
@ -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);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user