symfony - Symfony2, FOSUserBundle, authentication with cookies disabled -
how can authentication in symfony2 without cookies in brouser? how can generate http://some.site/hello/roman?phpsessid=9ebca8bd62c830d3e79272b4f585ff8f or http://some.site/9ebca8bd62c830d3e79272b4f585ff8f/hello/roman or other url available sessionid parameter. thank help.
you have to 2 things. first must extend session storage session query param.
namespace elao\backbundle\session; use symfony\component\dependencyinjection\containerinterface; use symfony\component\httpfoundation\session\storage\nativefilesessionstorage; class storage extends nativesessionstorage { public function __construct($savepath = null, array $options = array(), containerinterface $container) { $request = $container->get('request'); if ($request->query->has('sessionid')) { $request->cookies->set(session_name(), 1); // have simulate cookie, in order bypass "hasprevioussession" security check session_id($request->query->get('sessionid')); } return parent::__construct($savepath, $options); } }
source: http://www.elao.com/blog/symfony-2/symfony-2-loading-session-from-query-param.html
the next point, should replacing urlgenerator generate every url session id param. example this, can found in this answer.
but nifr in comment said, it's not clean requirement.
Comments
Post a Comment