This commit is contained in:
aozhiwei 2024-06-03 14:39:26 +08:00
parent 88816670a6
commit d27252b9e1

View File

@ -7,6 +7,12 @@ const jwt = require('jsonwebtoken');
const LOCK_KEY = 'getJwtLock:';
const jwksKeyHash = {};
async function refreshKey() {
while (true) {
await utils.sleep(1000 * 60 * 5);
}
}
async function asyncGetKey(jkwsUri, header, cb) {
await app.lock(LOCK_KEY + jkwsUri);
try {
@ -24,6 +30,7 @@ async function asyncGetKey(jkwsUri, header, cb) {
if (!err) {
jwksKeyHash[jwksUri] = {
'key': key,
'header': header,
'lastRefreshTime': utils.getUtcTime()
};
}