-
Notifications
You must be signed in to change notification settings - Fork 21
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
Listing Sessions by User Identifier #40
Comments
Hey @savsgio just wondering if you had time to look at this? I understand you may not want to implement this locally, but it would be nice to know one way or another, and if you do, would like some direction. After having thought about this a long while, I think it would make more sense to make it a breaking change as part of v3. |
Hi @james-d-elliott, Lately, I'm very busy with my work. Thanks! |
@savsgio sorry to bother you, I understand you likely are busy with other priorities. Some guidance on the above request would be appreciated so we can fully understand our options and plan accordingly. |
Hi @james-d-elliott and @nightah, I understand that you need a composed key for the sessions, the I'm honestly not sure for this change, because the change could add some complexity that could be fixed with an external tracking. |
And sorry for my delayed answer, but i've been very busy lately. 😅 |
Thanks for your reply. Now that I think about it we're most likely better of reimplementing the providers we're using (currently memory/redis), and extending the interface specific to our needs. As long as our interface implements all the same methods as yours and just adds more, we can just ensure it stores it in a method where we can lookup the values we need! |
@savsgio is this a sufficient preamble for us to make a nearly exact copy of the providers? For https://github.com/fasthttp/session/blob/master/providers/memory/provider.go:
For https://github.com/fasthttp/session/blob/master/providers/redis/provider.go:
|
Hi @james-d-elliott, Yes, that's okay! Sorry for delayed answer. |
I have a feeling it's just going to be more logical to implement this downstream rather than trying to implement it in fasthttp/session, but I figured I'd ask what you think anyway - plus, maybe this idea is really desirable for other users.
Authelia is currently using the memory/redis providers of this lib. Basically what we will be intending to do is give users the ability to lookup their active sessions as well as information about the sessions and optionally destroy them. The complication is that we'd have to store and keep track of ID's belonging to each user which likely is fairly impractical.
My only idea in working around this is to implement additional funcs in the interface, that allow getting a list of session ID's belonging to a specific lookup value, which would also require we add funcs to save with the lookup value. Additionally ideally it would include a specific EncodeFunc to encode the lookup key, though this reasonably can be done locally too.
In the example below GetWithUserIdentifier would return all session data for a given UserIdentifier, GetSessionIDs would return a list of session ID's for a given UserIdentifier to be used with Get, SaveWithUserIdentifer would obviously operate the same as Save except it would include the UserIdentifier which would be required to use the other funcs, DestroyWithUserIdentifier would destroy the given session with the given ID provided the given UserIdentifier matched.
The text was updated successfully, but these errors were encountered: