Skip to content

Commit

Permalink
Merge pull request #9 from Telefonica/fix/removeKidRestriction
Browse files Browse the repository at this point in the history
FIX issue
  • Loading branch information
David Lozano committed Dec 15, 2016
2 parents da71abe + 5cf034e commit cac36cc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
4 changes: 0 additions & 4 deletions lib/jwt-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ module.exports = function(configuration) {

var header = readJWTHeader(segments[0]);

if (!header.kid) {
throw errors.MISSING_REQUIRED_KID();
}

var algorithm = header.alg || 'HS256';

if (!hashAlgorithms[header.alg]) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jwt-utils",
"description": "JSON Web Tokens (JWT) utils",
"version": "1.0.3",
"version": "1.0.4",
"license": "Apache-2.0",
"author": {
"name": "Guido García Bernardo",
Expand Down
12 changes: 0 additions & 12 deletions test/unit/jwt-utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,18 +487,6 @@ describe('Jwt Utils Tests', function() {
});
});

it('should fail to read an unencrypted token without kid', function() {
var jwtToken = 'eyJhbGciOiJIUzI1NiJ9.eyJpc' +
'3MiOiIiLCJqdGkiOiIiLCJpYXQiOjEzNzQwNzg4' +
'NzF9.khagsjdgjas';

var hashKey = '11111111111111111111111111111111';
jwtUtils.readJWT(jwtToken, hashKey, function(err, token) {
expect(err).to.be.apiError(errors.MISSING_REQUIRED_KID());
expect(token).not.to.exist;
});
});

it('should fail to read an unencrypted token without a valid algorithm', function() {
var jwtToken = 'eyJhbGciOiJIUzI1NyIsICJraWQiOiJteUtpZCJ9.eyJpc' +
'3MiOiIiLCJqdGkiOiIiLCJpYXQiOjEzNzQwNzg4' +
Expand Down

0 comments on commit cac36cc

Please sign in to comment.