-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include standard claims from payload. closes #196
- Loading branch information
1 parent
d805573
commit b51e31f
Showing
2 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |