-
-
Notifications
You must be signed in to change notification settings - Fork 143
Allow a custom Session Id separator #792
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
Allow a custom Session Id separator #792
Conversation
Thank you for this. Just a small question: when you say “single table pattern”, you you mean multiple applications that share the same table? |
yes, that's the use case.
Well, I do define the session name in both application in which I'm assuming it is the prefix. By that I mean in one application I can have session name to be |
I'm not sure to understand what problem does it solve. |
@jderusse it solves the problem that I can define my own separator to have multiple sessions from multiple application in a single table. Because the code does not allow me to extend this to change the separator. Line 2 is what I want to achieve line 4 is what I get with the current code (replace 3cket with BACKOFFICE). The usual separator when using single table design/pattern is the |
using separator to namespace application sounds hacky. You should use a prefix for this as suggested by @Nyholm . But, I don't think it's necessary. Each application should have its own session is, you shouldn't have any conflict. If the issue is about |
TBH I didn't look into it.
Defining the
Well, thats not my decision. But be aware of that changing this to |
I think the Since @dcsg clearly has a use case for it, then I dont mind merging this PR. What Im currently dont know (and it may be work for a later PR) is if we should update our default or not. |
The pattern I described is There isn't a strict rule that say it must be |
I would say that probably most people don't use the Single Table Pattern so the separator for them does not matter much. But giving the possibility to customize it, would allow those that use the pattern to have the same separator for everything. Also since there isn't a strict rule for this (the separator), it means that others might choose a completly different character for the separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im happy with this PR.
We should consider using #
as our default separator before 1.0
If the goal is to replace If the purpose is to namespace app (let's say App Unless I missed another use case, I'm 👎 for this PR. |
@guillaumesmo do you remember if there were any specific reason you decided to use |
Usually that's not what happens, when you use the Single Table Pattern you use the same separator for that table. However, that separator might be Having a separator might be overkill but in that case we can simple remove it and then it is simple has setting the session name with the separator you like, eg: |
yes: https://github.com/aws/aws-sdk-php/blob/master/src/DynamoDb/SessionHandler.php#L233 edit to make it clear, idea was to keep 1:1 functionality with aws-sdk so that migration can be done without losing sessions |
Hello @dcsg , did you tried using session name in both App? With symfony: framework:
session:
name: A If you don't use symfony, did you tried with https://www.php.net/manual/fr/function.session-name.php session_name('A'); This is the simplest way to define a prefix. |
1 similar comment
Hello @dcsg , did you tried using session name in both App? With symfony: framework:
session:
name: A If you don't use symfony, did you tried with https://www.php.net/manual/fr/function.session-name.php session_name('A'); This is the simplest way to define a prefix. |
This is how I do define the prefix, but again I cannot control the separator. |
why do you need to control the separator? What problem does it solve? in this comment #792 (comment) you say "it solves the problem that I can define my own separator" it does not explain what is the original problem with |
I explained it. Usually when using single table pattern the separator is the |
You mean, you have 2 applications, that share the same table, and share the sames session data? Both applications use the same prefix (in order to read the same data), both application are able to deserialize php session and extract data from _sf2_attributes? Having |
Instead of continue to explain my self again and again I will put this in this terms. Me as a user of this lib I want the ability to customize the separator. Saying this, what harm does it does by allowing it? And what cons exists to allow it? |
are you storing anything other than sessions in the dynamoDb table? |
yes |
Ok, I finally get what you are trying to achieve |
Thank you @dcsg |
I must admit that I didn't really understand "single table pattern" either. Thank you @dcsg for your patience. |
In order to use the single table pattern of DynamoDB it would be nice to customize the separator to fit different use cases. This PR adds that possibility by allowing to define that option.