Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Commit

Permalink
removing jet-simple from all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert committed Sep 12, 2015
1 parent 70e6a01 commit 23bde95
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/it/api_auth_it.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var jwt = require('jwt-simple');
var nJwt = require('njwt');
var common = require('../common');
var helpers = require('./helpers');
var assert = common.assert;
Expand Down Expand Up @@ -304,10 +304,10 @@ describe('Application.authenticateApiRequest',function(){
var result;
before(function(done){

var decodedAccessToken = jwt.decode(accessToken,
var decodedJwt = nJwt.verify(accessToken,
client._dataStore.requestExecutor.options.apiKey.secret,'HS256');
decodedAccessToken.scope += ' things-i-cant-have';
var tamperedToken = jwt.encode(decodedAccessToken,'not the same key','HS256');
decodedJwt.body.scope += ' things-i-cant-have';
var tamperedToken = nJwt.create(decodedJwt.body,'not the same key','HS256').compact();
var requestObject = {
headers: {
'authorization': 'Bearer ' + tamperedToken
Expand Down Expand Up @@ -568,7 +568,7 @@ describe('Application.authenticateApiRequest',function(){
}
},function(err,value){
result = [err,value];
decodedAccessToken = jwt.decode(result[1].tokenResponse.access_token,
decodedAccessToken = nJwt.verify(result[1].tokenResponse.access_token,
client._dataStore.requestExecutor.options.apiKey.secret,'HS256');
done();
});
Expand All @@ -589,7 +589,7 @@ describe('Application.authenticateApiRequest',function(){
});

it('should add the scope to the token',function(){
assert.equal(decodedAccessToken.scope,givenScope.join(' '));
assert.equal(decodedAccessToken.body.scope,givenScope.join(' '));
});

it('should add the scope to authResult',function(){
Expand Down Expand Up @@ -619,7 +619,7 @@ describe('Application.authenticateApiRequest',function(){
},function(err,value){
result = [err,value];
tokenResponse = value.tokenResponse;
decodedAccessToken = jwt.decode(result[1].tokenResponse.access_token,
decodedAccessToken = nJwt.verify(result[1].tokenResponse.access_token,
client._dataStore.requestExecutor.options.apiKey.secret,'HS256');
done();
});
Expand Down

0 comments on commit 23bde95

Please sign in to comment.