mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-09 09:37:01 +02:00
fix: error while signing in with OIDC if roles claim is undefined
This commit is contained in:
@@ -149,7 +149,10 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
|
||||
// A path to read roles from the token is configured
|
||||
let roles: string[] = [];
|
||||
try {
|
||||
roles = jmespath.search(idTokenData, roleConfig.path);
|
||||
const rolesClaim = jmespath.search(idTokenData, roleConfig.path);
|
||||
if (Array.isArray(rolesClaim)) {
|
||||
roles = rolesClaim;
|
||||
}
|
||||
} catch (e) {
|
||||
this.logger.warn(
|
||||
`Roles not found at path ${roleConfig.path} in ID Token ${JSON.stringify(
|
||||
|
||||
Reference in New Issue
Block a user