Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'no keys found, incorrect Signature, validation failed for id_token'
);
return false;
} else if (amountOfMatchingKeys > 1) {
this.loggerService.logWarning(
'no ID Token kid claim in JOSE header and multiple supplied in jwks_uri'
);
return false;
} else {
for (const key of jwtkeys.keys) {
if (
(key.kty as string) === 'RSA' &&
(key.use as string) === 'sig'
) {
const publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, [
'RS256'
]);
if (!isValid) {
this.loggerService.logWarning(
'incorrect Signature, validation failed for id_token'
);
}
return isValid;
}
}
}
} else {
// kid in the Jose header of id_token
for (const key of jwtkeys.keys) {
if ((key.kid as string) === (kid as string)) {
const publickey = KEYUTIL.getKey(key);
if (key.kty as string === 'RSA' && key.use as string === 'sig') {
const publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.oidcSecurityCommon.logWarning('incorrect Signature, validation failed for id_token');
}
return isValid;
}
}
}
} else {
// kid in the Jose header of id_token
for (const key of jwtkeys.keys) {
if (key.kid as string === kid as string) {
const publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.oidcSecurityCommon.logWarning('incorrect Signature, validation failed for id_token');
}
return isValid;
}
}
}
return isValid;
}
if ((key.kty as string) === 'RSA' && (key.use as string) === 'sig') {
amountOfMatchingKeys = amountOfMatchingKeys + 1;
}
}
if (amountOfMatchingKeys === 0) {
this.loggerService.logWarning('no keys found, incorrect Signature, validation failed for id_token');
return false;
} else if (amountOfMatchingKeys > 1) {
this.loggerService.logWarning('no ID Token kid claim in JOSE header and multiple supplied in jwks_uri');
return false;
} else {
for (const key of jwtkeys.keys) {
if ((key.kty as string) === 'RSA' && (key.use as string) === 'sig') {
const publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.loggerService.logWarning('incorrect Signature, validation failed for id_token');
}
return isValid;
}
}
}
} else {
// kid in the Jose header of id_token
for (const key of jwtkeys.keys) {
if ((key.kid as string) === (kid as string)) {
const publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.loggerService.logWarning('incorrect Signature, validation failed for id_token');
}
var publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.loggerService.logWarning('incorrect Signature, validation failed for id_token');
}
return isValid;
}
}
}
}
else {
for (var _d = 0, _e = jwtkeys.keys; _d < _e.length; _d++) {
var key = _e[_d];
if (key.kid === kid) {
var publickey = KEYUTIL.getKey(key);
isValid = KJUR.jws.JWS.verify(id_token, publickey, ['RS256']);
if (!isValid) {
this.loggerService.logWarning('incorrect Signature, validation failed for id_token');
}
return isValid;
}
}
}
return isValid;
};
OidcSecurityValidation.prototype.config_validate_response_type = function (response_type) {