Skip to content

Commit 9b18038

Browse files
author
Chris Robison
committed
Fixing JoseUtil aud validation to be more in line with spec
https://tools.ietf.org/html/rfc7519#section-4.1.3 says that aud, in general, will be an array, but a single value is allowed to be just a string, but they may not necessarily be the case.
1 parent 33ffe5a commit 9b18038

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/JoseUtil.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class JoseUtil {
7878
return Promise.reject(new Error("Invalid issuer in token: " + payload.iss));
7979
}
8080

81-
if (payload.aud !== audience) {
81+
if (payload.aud !== audience && (Array.isArray(payload.aud) && payload.aud.indexOf(audience) === -1)) {
8282
Log.error("Invalid audience in token", payload.aud);
8383
return Promise.reject(new Error("Invalid audience in token: " + payload.aud));
8484
}

0 commit comments

Comments
 (0)