Skip to content

Commit f31bc6d

Browse files
committed
fix: fix linter and test issues
1 parent 583616a commit f31bc6d

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"moment": "^2.29.4",
6363
"mongodb": "^5.0.0",
6464
"nodemailer": "^6.6.1",
65-
"openid-client": "^6.3.1",
65+
"openid-client": "^6.4.2",
6666
"parse-diff": "^0.11.1",
6767
"passport": "^0.7.0",
6868
"passport-activedirectory": "^1.0.4",

src/service/passport/jwtAuthHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { assignRoles, validateJwt } = require('./jwtUtils');
33
/**
44
* Middleware function to handle JWT authentication.
55
* @param {*} overrideConfig optional configuration to override the default JWT configuration (e.g. for testing)
6-
* @returns {Function} the middleware function
6+
* @return {Function} the middleware function
77
*/
88
const jwtAuthHandler = (overrideConfig = null) => {
99
return async (req, res, next) => {

src/service/passport/oidc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ const db = require('../../db');
33
let type;
44

55
const configure = async (passport) => {
6-
const openIdClient = await import('openid-client');
7-
const { Strategy } = await import('openid-client/passport');
8-
96
const authMethods = require('../../config').getAuthMethods();
107
const oidcConfig = authMethods.find((method) => method.type.toLowerCase() === "openidconnect")?.oidcConfig;
118
const { issuer, clientID, clientSecret, callbackURL, scope } = oidcConfig;
@@ -15,6 +12,8 @@ const configure = async (passport) => {
1512
}
1613

1714
const server = new URL(issuer);
15+
const openIdClient = await import('openid-client');
16+
const { Strategy } = await import('openid-client/passport');
1817

1918
try {
2019
const config = await openIdClient.discovery(server, clientID, clientSecret);

test/testJwtAuthHandler.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ describe('getJwks', () => {
3333
});
3434

3535
describe('validateJwt', () => {
36-
let decodeStub, verifyStub, pemStub, getJwksStub;
36+
let decodeStub;
37+
let verifyStub;
38+
let pemStub;
39+
let getJwksStub;
3740

3841
beforeEach(() => {
3942
const jwksResponse = { keys: [{ kid: 'test-key', kty: 'RSA', n: 'abc', e: 'AQAB' }] };
@@ -112,7 +115,11 @@ describe('assignRoles', () => {
112115
});
113116

114117
describe('jwtAuthHandler', () => {
115-
let req, res, next, jwtConfig, validVerifyResponse;
118+
let req;
119+
let res;
120+
let next;
121+
let jwtConfig;
122+
let validVerifyResponse;
116123

117124
beforeEach(() => {
118125
req = { header: sinon.stub(), isAuthenticated: sinon.stub(), user: {} };

0 commit comments

Comments
 (0)