From 67409979004cd373814a5cc598869b4eb1d88d3a Mon Sep 17 00:00:00 2001 From: "Robert St. John" Date: Sun, 1 Dec 2024 07:22:21 -0700 Subject: [PATCH] refactor(service): users/auth: remove unnecessary express session middleware; mage does not require a session cookie --- service/src/express.js | 4 ---- service/src/ingress/ingress.main.ts | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/service/src/express.js b/service/src/express.js index 5a49fe017..b5cd6a254 100644 --- a/service/src/express.js +++ b/service/src/express.js @@ -29,9 +29,6 @@ app.use(function(req, res, next) { return next(); }); -const secret = crypto.randomBytes(64).toString('hex'); -app.use(session({ secret })); - app.set('config', config); app.enable('trust proxy'); @@ -44,7 +41,6 @@ app.use( express.urlencoded( { ...jsonOptions, extended: true })); app.use(passport.initialize()); -app.use(passport.session()); app.get('/api/docs/openapi.yaml', async function(req, res) { const docPath = path.resolve(__dirname, 'docs', 'openapi.yaml'); fs.readFile(docPath, (err, contents) => { diff --git a/service/src/ingress/ingress.main.ts b/service/src/ingress/ingress.main.ts index e23090e95..15fff8948 100644 --- a/service/src/ingress/ingress.main.ts +++ b/service/src/ingress/ingress.main.ts @@ -68,20 +68,6 @@ export async function initializeIngress( provisioning: provision.ProvisionStatic, passport: passport.Authenticator, ): Promise { - // TODO: users-next: these serialization functions are probably no longer necessary - passport.serializeUser((user, done) => done(null, user.id)) - passport.deserializeUser(async (id, done) => { - try { - const user = await userRepo.findById(String(id)) - done(null, user) - } - catch (err) { - done(err) - } - }) - const routes = express.Router() - registerAuthenticatedBearerTokenHandling(passport, sessionRepo, userRepo) - return routes } /**