Skip to content

Commit

Permalink
fix: omit *_hash ID Token claims if signed with "none" (code flow only)
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Nov 5, 2019
1 parent c6b1770 commit 5c540c0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/models/id_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ module.exports = function getIdToken(provider) {
throw new TypeError('invalid use option');
}

hashes.forEach((claim) => {
if (payload[claim]) {
payload[claim] = tokenHash(payload[claim], alg);
}
});
if (alg && alg !== 'none') {
hashes.forEach((claim) => {
if (payload[claim]) {
payload[claim] = tokenHash(payload[claim], alg);
}
});
}

const signed = await (() => {
if (!alg) {
Expand Down

0 comments on commit 5c540c0

Please sign in to comment.