1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Remove unused token expiry code

This commit is contained in:
Nick O'Leary 2015-02-04 15:23:02 +00:00
parent fbf7ee50eb
commit 53a515176b
2 changed files with 2 additions and 31 deletions

View File

@ -50,15 +50,7 @@ module.exports = {
sessionModule.init(settings);
},
get: function(token) {
return sessionModule.get(token).then(function(session) {
if (session && session.accessExpires < Date.now()) {
return sessionModule.delete(token).then(function() {
return null;
});
} else {
return session;
}
})
return sessionModule.get(token);
},
create: function(user,client,scope) {
var accessToken = generateToken(128);

View File

@ -67,7 +67,7 @@ describe("Tokens", function() {
Tokens.init({sessionStorageModule:{
init:function(settings){},
get: function(token) {
return when.resolve({user:"fred",accessExpires: Date.now()+10000});
return when.resolve({user:"fred"});
}
}});
@ -80,27 +80,6 @@ describe("Tokens", function() {
}
});
});
it('deletes an expired token and returns null', function(done) {
var sessionStorageModule = {
init:function(settings){},
get: function(token) {
return when.resolve({user:"fred",accessExpires: Date.now()-10000});
},
delete: sinon.stub().returns(when.resolve())
};
Tokens.init({sessionStorageModule:sessionStorageModule});
Tokens.get("1234").then(function(token) {
try {
should.not.exist(token);
sessionStorageModule.delete.calledWith("1234").should.be.true;
done();
} catch(err) {
done(err);
}
});
});
it('returns null for an invalid token', function(done) {
Tokens.init({sessionStorageModule:{