adapt to soko-web 0.4
This commit is contained in:
16 files changed
+54
-106
No files matched your search
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SokoWeb\Response\HttpResponse;
|
||||
|
||||
require 'app.php';
|
||||
|
||||
if (!empty($_ENV['DEV'])) {
|
||||
@@ -77,11 +79,6 @@ if (isset($_COOKIE[session_name()])) {
|
||||
]);
|
||||
}
|
||||
|
||||
// this is needed to handle old type of session IDs
|
||||
if (!Container::$sessionHandler->validateId(session_id())) {
|
||||
session_regenerate_id(true);
|
||||
}
|
||||
|
||||
Container::$request = new SokoWeb\Request\Request(
|
||||
$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
|
||||
$_GET,
|
||||
@@ -95,5 +92,19 @@ if (!Container::$request->session()->has('anti_csrf_token')) {
|
||||
Container::$request->session()->set('anti_csrf_token', bin2hex(random_bytes(16)));
|
||||
}
|
||||
|
||||
//TODO: make a nicer logic
|
||||
$antiCsrfTokenExceptions = ['oauth/token'];
|
||||
$appConfig = [
|
||||
'antiCsrfTokenName' => 'anti_csrf_token',
|
||||
'antiCsrfTokenErrorResponse' => ['error' => 'no_valid_anti_csrf_token'],
|
||||
'antiCsrfTokenExceptions' => ['oauth/token'],
|
||||
'loginRouteId' => 'login',
|
||||
'error404View' => 'error/404'
|
||||
];
|
||||
|
||||
$httpReponse = new HttpResponse(
|
||||
Container::$request,
|
||||
Container::$routeCollection,
|
||||
$appConfig,
|
||||
$_SERVER['REQUEST_METHOD'],
|
||||
$_SERVER['REQUEST_URI']
|
||||
);
|
||||
$httpReponse->render();
|
||||
Reference in new issue
Block a user