Set cookie to httponly

This commit is contained in:
Igor Scheller 2017-09-20 11:07:25 +02:00
parent 31414905d7
commit c6ef1120f8
1 changed files with 3 additions and 4 deletions

View File

@ -12,6 +12,7 @@ use Engelsystem\Routing\UrlGenerator;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
/** /**
* This file includes all needed functions, connects to the db etc. * This file includes all needed functions, connects to the db etc.
@ -198,10 +199,8 @@ foreach ($includeFiles as $file) {
/** /**
* Init application * Init application
*/ */
$session = new Session(); $sessionStorage = (PHP_SAPI != 'cli' ? new NativeSessionStorage(['cookie_httponly' => true]) : new MockArraySessionStorage());
if (PHP_SAPI == 'cli') { $session = new Session($sessionStorage);
$session = new Session(new MockArraySessionStorage());
}
$app->instance('session', $session); $app->instance('session', $session);
$session->start(); $session->start();
$request->setSession($session); $request->setSession($session);