Skip to content

feat: add mongo session store #1884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 7, 2025
Merged

feat: add mongo session store #1884

merged 9 commits into from
May 7, 2025

Conversation

minottic
Copy link
Contributor

@minottic minottic commented May 5, 2025

Description

Built based on #1804, it refactors express session to use nestjs middlewars and DI

Motivation

Allows stateful sessions in case of multiple replicas deployment. Mongo store is configurable, and if left empty, it falls back to Memorystore.

Changes:

  • refactor app.use to middleware
  • DI configService
  • DI mongoConnection
  • configurable mongo Store
  • reuse session DB from default
  • uses JWT expiration as session expiration
  • it restricts middleware to /oidc endpoints

Tests included

  • Included for each change/fix?
  • Passing?

Documentation

  • swagger documentation updated (required for API changes)
  • official documentation updated

official documentation info

@minottic
Copy link
Contributor Author

minottic commented May 5, 2025

superseeds #1803

@minottic minottic force-pushed the mongo_session branch 3 times, most recently from 50865b1 to dad5af3 Compare May 5, 2025 19:18
@belfhi
Copy link

belfhi commented May 6, 2025

ah this looks great! I haven't had much time to look into my MR, so I'm happy my suggestion was taken up :)

Copy link
Member

@Junjiequan Junjiequan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@minottic minottic merged commit 7c6a192 into master May 7, 2025
13 checks passed
@minottic minottic deleted the mongo_session branch May 7, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants