You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as stated in this message
It would be really cool if we could have built in session management for users
Is your feature request related to a problem? Please describe.
Currently concurrent sessions are allowed by default in serverpod. Pen testing identifies this as a minor security concern
Describe the solution you'd like
Larger companies deal with this by having a way in your account to view all of your current sessions associated with your account. Here you can see all of the devices and locations your currently signed into and manually sign them out / kick them out. It would be good if serverpod had ways to fetch this information and manage those sessions from the server.
Describe alternatives you've considered
Alternatively, it would also be good for getting simple solution out if you could just configure whether you allow concurrent sessions for a single user, whether new sessions on new devices should kick users out of their other sessions, etc.
Additional context
This was identified to us by an external pen test and upon investigation, we realised that the serverpod sessions are not interactive currently and are more of an under-the-hood feature that is not accessible. We were still able to pass the test however due to this being classified as a minor security risk
Providing a good developer experience around this would be a real win for the Auth module.
I don't think it should be that much work either. I am noting down some information about this here if you would either like to implement your own solution or provide a contribution to Serverpod on this if we don't get around to it fast enough.
For each successful login attempt to the server, a unique token Is created and stored for that user. These are stored in the serverpod_auth_key table along with the connected userId. To ensure that only a single device is able to successfully authenticate there should only exist a single entry in that table with the userId.
So, upon successful login, that table could be purged from the unique userId before a new record is stored.
The table is accessed through the AuthKey model and associated database operations.
We now provide multiple ways to sign out a user from all devices, we still however do not support doing this when a user signs in (ensuring that only a single devices is authenticated at a time).
Activity
SandPod commentedon Mar 4, 2024
Hey @kieran-novarca!
Providing a good developer experience around this would be a real win for the Auth module.
I don't think it should be that much work either. I am noting down some information about this here if you would either like to implement your own solution or provide a contribution to Serverpod on this if we don't get around to it fast enough.
For each successful login attempt to the server, a unique token Is created and stored for that user. These are stored in the
serverpod_auth_keytable along with the connecteduserId. To ensure that only a single device is able to successfully authenticate there should only exist a single entry in that table with theuserId.So, upon successful login, that table could be purged from the unique userId before a new record is stored.
The table is accessed through the
AuthKeymodel and associated database operations.SandPod commentedon Jan 2, 2025
This request is very similair to: #2995
We now provide multiple ways to sign out a user from all devices, we still however do not support doing this when a user signs in (ensuring that only a single devices is authenticated at a time).