Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: auth0/node-jsonwebtoken
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.0
Choose a base ref
...
head repository: auth0/node-jsonwebtoken
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.1.1
Choose a head ref
  • 6 commits
  • 6 files changed
  • 3 contributors

Commits on Feb 22, 2016

  1. Copy the full SHA
    df76918 View commit details

Commits on Apr 27, 2016

  1. update changelog

    jfromaniello committed Apr 27, 2016
    Copy the full SHA
    805580a View commit details
  2. Merge pull request #177 from risseraka/patch-1

    fix duplicate subject in README's options list
    jfromaniello committed Apr 27, 2016
    Copy the full SHA
    05336fd View commit details
  3. update travis.yml

    jfromaniello committed Apr 27, 2016
    Copy the full SHA
    d805573 View commit details

Commits on Apr 28, 2016

  1. Copy the full SHA
    b51e31f View commit details
  2. 6.1.1

    jfromaniello committed Apr 28, 2016
    Copy the full SHA
    252110e View commit details
Showing with 27 additions and 7 deletions.
  1. +2 −2 .travis.yml
  2. +4 −0 CHANGELOG.md
  3. +0 −1 README.md
  4. +1 −1 package.json
  5. +5 −3 sign.js
  6. +15 −0 test/issue_196.tests.js
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
before_install: npm i -g npm@1.4.28
node_js:
- 0.8
- 0.10
- "5"
- "4"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file starting from version **v4.0.0**.
This project adheres to [Semantic Versioning](http://semver.org/).

## 6.1.0 - 2016-04-27

- verify unsigned tokens ([ec880791c10ed5ef7c8df7bf28ebb95c810479ed](https://github.com/auth0/node-jsonwebtoken/commit/ec880791c10ed5ef7c8df7bf28ebb95c810479ed))

## 6.0.1 - 2016-04-27

This was an immediate change after publishing 6.0.0.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ encoded private key for RSA and ECDSA.
* `expiresIn`: expressed in seconds or a string describing a time span [rauchg/ms](https://github.com/rauchg/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"`
* `notBefore`: expressed in seconds or a string describing a time span [rauchg/ms](https://github.com/rauchg/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"`
* `audience`
* `subject`
* `issuer`
* `jwtid`
* `subject`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonwebtoken",
"version": "6.1.0",
"version": "6.1.1",
"description": "JSON Web Token implementation (symmetric and asymmetric)",
"main": "index.js",
"scripts": {
8 changes: 5 additions & 3 deletions sign.js
Original file line number Diff line number Diff line change
@@ -93,10 +93,12 @@ module.exports = function(payload, secretOrPrivateKey, options, callback) {

Object.keys(options_to_payload).forEach(function (key) {
var claim = options_to_payload[key];
if (typeof options[key] !== 'undefined' && typeof payload[claim] !== 'undefined') {
throw new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.');
if (typeof options[key] !== 'undefined') {
if (typeof payload[claim] !== 'undefined') {
throw new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.');
}
payload[claim] = options[key];
}
payload[claim] = options[key];
});

var encoding = options.encoding || 'utf8';
15 changes: 15 additions & 0 deletions test/issue_196.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var expect = require('chai').expect;
var jwt = require('./..');
var atob = require('atob');

describe('issue 196', function () {
function b64_to_utf8 (str) {
return decodeURIComponent(escape(atob( str )));
}

it('should use issuer provided in payload.iss', function () {
var token = jwt.sign({ iss: 'foo' }, 'shhhhh');
var decoded_issuer = JSON.parse(b64_to_utf8(token.split('.')[1])).iss;
expect(decoded_issuer).to.equal('foo');
});
});