From d18b076ae91eb33f8d2d7d9536cda0ee3e1fb65b Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 1 Dec 2015 16:09:50 +0100 Subject: [PATCH] Add test cases for new VerifyOptions --- jsonwebtoken/jsonwebtoken-tests.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jsonwebtoken/jsonwebtoken-tests.ts b/jsonwebtoken/jsonwebtoken-tests.ts index 52f1163353..c4e42f0543 100644 --- a/jsonwebtoken/jsonwebtoken-tests.ts +++ b/jsonwebtoken/jsonwebtoken-tests.ts @@ -57,6 +57,18 @@ jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function( // if issuer mismatch, err == invalid issuer }); +// verify algorithm +cert = fs.readFileSync('public.pem'); // get public key +jwt.verify(token, cert, { algorithms: ['RS256'] }, function(err, decoded) { + // if issuer mismatch, err == invalid issuer +}); + +// verify without expiration check +cert = fs.readFileSync('public.pem'); // get public key +jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { + // if issuer mismatch, err == invalid issuer +}); + /** * jwt.decode * https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken