Remove oauth

A whole bunch of useless stuff
This commit is contained in:
Johannes Zellner
2020-02-05 18:15:53 +01:00
parent bfffde5f89
commit 4ae12ac10b
18 changed files with 3 additions and 2558 deletions
-33
View File
@@ -7,7 +7,6 @@
'use strict';
var async = require('async'),
authcodedb = require('../authcodedb.js'),
BoxError = require('../boxerror.js'),
database = require('../database'),
expect = require('expect.js'),
@@ -16,19 +15,6 @@ var async = require('async'),
tokendb = require('../tokendb.js');
describe('janitor', function () {
var AUTHCODE_0 = {
authCode: 'authcode-0',
clientId: 'clientid-0',
userId: 'userid-0',
expiresAt: Date.now() + 60 * 60 * 1000
};
var AUTHCODE_1 = {
authCode: 'authcode-1',
clientId: 'clientid-1',
userId: 'userid-1',
expiresAt: Date.now() - 5000
};
var TOKEN_0 = {
id: 'tid-0',
accessToken: hat(8 * 32),
@@ -52,8 +38,6 @@ describe('janitor', function () {
async.series([
database.initialize,
database._clear,
authcodedb.add.bind(null, AUTHCODE_0.authCode, AUTHCODE_0.clientId, AUTHCODE_0.userId, AUTHCODE_0.expiresAt),
authcodedb.add.bind(null, AUTHCODE_1.authCode, AUTHCODE_1.clientId, AUTHCODE_1.userId, AUTHCODE_1.expiresAt),
tokendb.add.bind(null, TOKEN_0),
tokendb.add.bind(null, TOKEN_1)
], done);
@@ -70,23 +54,6 @@ describe('janitor', function () {
janitor.cleanupTokens(done);
});
it('did not remove the non-expired authcode', function (done) {
authcodedb.get(AUTHCODE_0.authCode, function (error, result) {
expect(error).to.be(null);
expect(result).to.be.eql(AUTHCODE_0);
done();
});
});
it('did remove expired authcode', function (done) {
authcodedb.get(AUTHCODE_1.authCode, function (error, result) {
expect(error).to.be.a(BoxError);
expect(error.reason).to.be(BoxError.NOT_FOUND);
expect(result).to.not.be.ok();
done();
});
});
it('did not remove the non-expired token', function (done) {
tokendb.getByAccessToken(TOKEN_0.accessToken, function (error, result) {
expect(error).to.be(null);