Skip to content

Commit

Permalink
refactor(service): users/auth: remove unnecessary express session mid…
Browse files Browse the repository at this point in the history
…dleware; mage does not require a session cookie
  • Loading branch information
restjohn committed Dec 1, 2024
1 parent 3270eba commit 6740997
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
4 changes: 0 additions & 4 deletions service/src/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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) => {
Expand Down
14 changes: 0 additions & 14 deletions service/src/ingress/ingress.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,6 @@ export async function initializeIngress(
provisioning: provision.ProvisionStatic,
passport: passport.Authenticator,
): Promise<express.Router> {
// 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
}

/**
Expand Down

0 comments on commit 6740997

Please sign in to comment.