From b32092f1cd45613c195bb87c3271b08a0a1d29bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 16 Apr 2023 16:03:11 +0200 Subject: [PATCH 1/2] upgrade soko-web to 0.2.1 --- composer.json | 2 +- composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index f10c652..273435e 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "esoko/soko-web": "0.1", + "esoko/soko-web": "0.2.1", "firebase/php-jwt": "^6.4" }, "require-dev": { diff --git a/composer.lock b/composer.lock index e2f002b..841e101 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f2dcf297a4a619bc5edfe7b4fac0836e", + "content-hash": "695034ad53031c4fdacbc6f551d610e3", "packages": [ { "name": "esoko/soko-web", - "version": "v0.1", + "version": "v0.2.1", "source": { "type": "git", "url": "https://git.esoko.eu/esoko/soko-web.git", - "reference": "a17a88e9d44e42cef3d996fc66b4dd1134b85def" + "reference": "4af7ae352108e7ba151fca2633ff4b40b3194b32" }, "require": { "phpmailer/phpmailer": "^6.8", @@ -33,7 +33,7 @@ "GNU GPL 3.0" ], "description": "Lightweight web framework", - "time": "2023-04-07T17:32:15+00:00" + "time": "2023-04-16T14:00:29+00:00" }, { "name": "firebase/php-jwt", -- 2.45.2 From c6d33753c80d24c4500378a240f31071de6ae490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 16 Apr 2023 16:03:38 +0200 Subject: [PATCH 2/2] adapt to new soko-web --- src/Controller/OAuthController.php | 8 +++----- web.php | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Controller/OAuthController.php b/src/Controller/OAuthController.php index 9b771f9..0666fe7 100644 --- a/src/Controller/OAuthController.php +++ b/src/Controller/OAuthController.php @@ -80,16 +80,14 @@ class OAuthController public function getUserInfo() : IContent { - //TODO: headers should be set by soko-web - $headers = getallheaders(); - - if (!isset($headers['Authorization'])) { + $authorization = $this->request->header('Authorization'); + if ($authorization === null) { return new JsonContent([ 'error' => 'No Authorization header was sent.' ]); } - $accessToken = substr($headers['Authorization'], strlen('Bearer ')); + $accessToken = substr($authorization, strlen('Bearer ')); $token = $this->oAuthTokenRepository->getByAccessToken($accessToken); if ($token === null || $token->getExpiresDate() < new DateTime()) { diff --git a/web.php b/web.php index ebe80da..1d35292 100644 --- a/web.php +++ b/web.php @@ -86,6 +86,7 @@ Container::$request = new SokoWeb\Request\Request( $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, + getallheaders(), $_SESSION, new RVR\Repository\UserRepository() ); -- 2.45.2