refs #6264 perf: remove files related to token

This commit is contained in:
Javier Segarra 2023-12-04 14:44:50 +01:00
parent d4cd23853f
commit b9671c0b67
2 changed files with 0 additions and 18 deletions

View File

@ -1,9 +0,0 @@
const tokenConfig = require('./token-config');
module.exports = async token => {
const accessTokenConfig = await tokenConfig();
const now = Date.now();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
return differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime;
};

View File

@ -1,9 +0,0 @@
const DEFAULT_FIELDS = ['renewPeriod', 'courtesyTime'];
const {models} = require('vn-loopback/server/server');
let currentAccessTokenConfig = null;
module.exports = async(fields = DEFAULT_FIELDS) => {
if (currentAccessTokenConfig) return currentAccessTokenConfig;
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields});
if (!accessTokenConfig) currentAccessTokenConfig = accessTokenConfig;
return accessTokenConfig;
};