Skip to content
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

[V2] Officially support authenticated sessions and allow to perform certain actions on them. #780

Merged
merged 16 commits into from
Jul 29, 2020

Conversation

LoicPoullain
Copy link
Member

@LoicPoullain LoicPoullain commented Jul 29, 2020

Issue

Resolves #510.
Resolves #778.
Resolves #779.

Solution and steps

  • Use an object argument in the Session constructor for better readability.
  • Add an optional field userId to Session.
  • Make all the three stores use Session.userId when saving and reading the session (and updating from redis).
  • Make @TokenRequired use Session.userId to authenticate the session.
  • Add TypeORMStore.getAuthenticatedUserIds()
  • Add TypeORMStore.destroyAllSessionsOf(user)
  • Add TypeORMStore.getSessionsOf(user)

Breaking changes

  • Interface of the Session constructor.
  • TypeORMStore only support numbers (not strings) as user IDs.
  • The userId is not stored in the session content.
  • Redis session key now starts with sessions: instead of session:.
  • MongoDB collection is now named sessions instead of foalSessions.

When migrating to v2, all users will be logged out.

When migrating to v2 (optional) :

  • remove the old TypeORM table,
  • remove the old MongoDB foalSessions collection.

Checklist

  • Add/update/check docs (code comments and docs/ folder).
  • Add/update/check tests.
  • Update/check the cli generators.

@LoicPoullain LoicPoullain added this to Work In Progress in Issue tracking via automation Jul 29, 2020
@LoicPoullain LoicPoullain merged commit 099549f into v2-0-0 Jul 29, 2020
Issue tracking automation moved this from Work In Progress to Done / Closed This Release Jul 29, 2020
@LoicPoullain LoicPoullain deleted the authenticated-users branch July 29, 2020 14:46
@LoicPoullain LoicPoullain mentioned this pull request Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue tracking
  
Done / Closed This Release
Development

Successfully merging this pull request may close these issues.

None yet

1 participant