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
|
// A path to read roles from the token is configured
|
||||||
let roles: string[] = [];
|
let roles: string[] = [];
|
||||||
try {
|
try {
|
||||||
roles = jmespath.search(idTokenData, roleConfig.path);
|
const rolesClaim = jmespath.search(idTokenData, roleConfig.path);
|
||||||
|
if (Array.isArray(rolesClaim)) {
|
||||||
|
roles = rolesClaim;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
`Roles not found at path ${roleConfig.path} in ID Token ${JSON.stringify(
|
`Roles not found at path ${roleConfig.path} in ID Token ${JSON.stringify(
|
||||||
|
|||||||
Reference in New Issue
Block a user