Skip to content

Commit

Permalink
added missing validations of sub and jti
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Feb 16, 2016
1 parent 8aedf2b commit a1affe9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ JWT.verify = function(jwtString, secretOrPublicKey, options, callback) {
return done(new JsonWebTokenError('jwt issuer invalid. expected: ' + options.issuer));
}

if (options.subject) {
if (payload.sub !== options.subject) {
return done(new JsonWebTokenError('jwt subject invalid. expected: ' + options.subject));
}
}

if (options.jwtid) {
if (payload.jti !== options.jwtid) {
return done(new JsonWebTokenError('jwt jwtid invalid. expected: ' + options.jwtid));
}
}

if (options.maxAge) {
var maxAge = ms(options.maxAge);
if (typeof payload.iat !== 'number') {
Expand Down

0 comments on commit a1affe9

Please sign in to comment.