How many Symfony or PHP sessions can run concurrently?

Let's say I have a Symfony2 application that separates two main packages: OneBundle

and TwoBundle

. OneBundle

acts as a backend for administration purposes and acts as a TwoBundle

RESTful API for external ones.

The thread for OneBundle

is for everyone to know: login to the admin system, do things and log out, or leave the application open or closed directly by the browser or in some other way close the application, in which case the session should be destroyed or photographed as defined in config.yml

(24 expiration hours for sessions).

Now TwoBundle

has a different flow: user login from Salesforce and gets a token, that token goes to the API endpoint and I create a new session to store the token as well as other information, user logout or client close app or whatever, and this session must be alive for a week not for 24 hours as the first one does.

Can the same Symfony2 application use two different sessions meaning one session for OneBundle

and one for TwoBundle

? Does PHP provide this? How do you deal with these business rules? Is it possible to save one session as default save handlers and another as PdoSessionHandler

?

+3


source to share


1 answer


This can be done by installing two firewalls in the security.yml file. One for "OneBundle" and one for your "TwoBundle", you can use a different security handler (FOSUser for the first, Native for the second), so Symfony's security is really flexible.

[edit]



You can see these pages in the symfony config:

+2


source







All Articles