zendframework / zend-session

Manage and preserve session data, a logical complement of cookie data, across multiple page requests by the same client.
BSD 3-Clause "New" or "Revised" License
42 stars 64 forks source link

Lazy session start #43

Open dekker-m opened 8 years ago

dekker-m commented 8 years ago

The current container object starts a session in the constructor automatically. This works fine for most use cases, but it could come in handy to use some kind of delayed session start. I'm working on a REST API which accepts API keys, but also check for authenticated users in their sessions. The authentication for the users are stored in sessions. However, every API call from a REST client generates a session. It will send a cookie to the REST client, while also storing the session information on disk. This should not happen with every API call by REST clients.

It would be great to have a container which does not automatically starts a session, only under the following circumstances:

mael-lg commented 6 years ago

I've the same problem on my application. Do you have any idea how to resolve this problem properly ?

Ocramius commented 6 years ago

Containers should not be injected, but rather requested at runtime. Session containers are NOT services.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-session; a new issue has been opened at https://github.com/laminas/laminas-session/issues/21.