move tokens.ID_ into oidcClients.ID_

This commit is contained in:
Girish Ramakrishnan
2025-06-11 22:53:29 +02:00
parent 00da650524
commit d112d6308c
11 changed files with 48 additions and 42 deletions

View File

@@ -9,6 +9,7 @@
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
oidcClients = require('../oidcclients.js'),
safe = require('safetydance'),
tokens = require('../tokens.js');
@@ -155,7 +156,7 @@ describe('Tokens', function () {
const token1 = {
name: 'token1',
identifier: 'user1',
clientId: tokens.ID_WEBADMIN,
clientId: oidcClients.ID_WEBADMIN,
expires: Number.MAX_SAFE_INTEGER,
lastUsedTime: null,
scope: { '*': 'rw' },
@@ -164,7 +165,7 @@ describe('Tokens', function () {
const token2 = {
name: 'token2',
identifier: 'user1',
clientId: tokens.ID_SDK,
clientId: oidcClients.ID_SDK,
expires: Date.now(),
lastUsedTime: null,
allowedIpRanges: '#this'
@@ -173,11 +174,11 @@ describe('Tokens', function () {
await tokens.add(token1);
await tokens.add(token2);
await tokens.delByUserIdAndType('user2', tokens.ID_WEBADMIN);
await tokens.delByUserIdAndType('user2', oidcClients.ID_WEBADMIN);
let result = await tokens.listByUserId('user1');
expect(result.length).to.be(2); // should not have deleted user1 tokens
await tokens.delByUserIdAndType('user1', tokens.ID_WEBADMIN);
await tokens.delByUserIdAndType('user1', oidcClients.ID_WEBADMIN);
result = await tokens.listByUserId('user1');
expect(result.length).to.be(1);
expect(result[0].name).to.be(token2.name);

View File

@@ -7,6 +7,7 @@
const common = require('./common.js'),
expect = require('expect.js'),
oidcClients = require('../oidcclients.js'),
tokens = require('../tokens.js'),
userDirectory = require('../user-directory.js');
@@ -24,7 +25,7 @@ describe('User Directory', function () {
});
it('can set default profile config', async function () {
await tokens.add({ name: 'token1', identifier: admin.id, clientId: tokens.ID_WEBADMIN, expires: Number.MAX_SAFE_INTEGER, lastUsedTime: null, allowedIpRanges: '' });
await tokens.add({ name: 'token1', identifier: admin.id, clientId: oidcClients.ID_WEBADMIN, expires: Number.MAX_SAFE_INTEGER, lastUsedTime: null, allowedIpRanges: '' });
let result = await tokens.listByUserId(admin.id);
expect(result.length).to.be(1); // just confirm the token was really added!