-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Description
AbstractSessionHandler should implement the interface SessionIdInterface.
Use case:
I have a small AP and I need to maintain a session without using cookies. In my case, the client passes the session ID in a custom HTTP header.
Currently I use an event subscriber to change the id of the session to the desired header value:
public function onKernelRequest(RequestEvent $event): bool
{
$request = $event->getRequest();
$session = $event->getRequest()->getSession();
$session->setId($request->headers->get('my-custom-header'));
return true;
}
This more or less works in most of the cases and fails if the session has already been started.
I think that is what the PHP interface SessionIdInterface (https://www.php.net/manual/en/class.sessionidinterface.php) is for:
interface SessionIdInterface {
/* Methods */
public create_sid(): string;
}
With this, I could implement my own create_sid() method, thus setting the correct session id from the begining.
Example
No response