jsonwebtoken
Advanced tools
Comparing version 5.6.2 to 5.7.0
@@ -257,4 +257,9 @@ var jws = require('jws'); | ||
if (options.issuer) { | ||
if (payload.iss !== options.issuer) | ||
var invalid_issuer = | ||
(typeof options.issuer === 'string' && payload.iss !== options.issuer) || | ||
(Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1); | ||
if (invalid_issuer) { | ||
return done(new JsonWebTokenError('jwt issuer invalid. expected: ' + options.issuer)); | ||
} | ||
} | ||
@@ -261,0 +266,0 @@ |
{ | ||
"name": "jsonwebtoken", | ||
"version": "5.6.2", | ||
"version": "5.7.0", | ||
"description": "JSON Web Token implementation (symmetric and asymmetric)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -81,3 +81,3 @@ # jsonwebtoken [![Build Status](https://secure.travis-ci.org/auth0/node-jsonwebtoken.png)](http://travis-ci.org/auth0/node-jsonwebtoken) | ||
* `audience`: if you want to check audience (`aud`), provide a value here | ||
* `issuer`: if you want to check issuer (`iss`), provide a value here | ||
* `issuer` (optional): string or array of strings of valid values for the `iss` field. | ||
* `ignoreExpiration`: if `true` do not validate the expiration of the token. | ||
@@ -84,0 +84,0 @@ * `ignoreNotBefore`... |
@@ -270,2 +270,10 @@ var jwt = require('../index'); | ||
it('should check the issuer when providing a list of valid issuers', function(done) { | ||
jwt.verify(token, pub, { issuer: [ 'urn:foo', 'urn:bar' ] }, function(err, decoded) { | ||
assert.isNotNull(decoded); | ||
assert.isNull(err); | ||
done(); | ||
}); | ||
}); | ||
it('should throw when invalid issuer', function(done) { | ||
@@ -272,0 +280,0 @@ jwt.verify(token, pub, { issuer: 'urn:wrong' }, function(err, decoded) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64866
1083