Merge pull request 'feature/upgrade-soko-web' (!21) from feature/upgrade-soko-web into master
All checks were successful
rvr-nextgen/pipeline/head This commit looks good

Reviewed-on: #21
This commit is contained in:
Bence Pőcze 2023-04-16 16:05:51 +02:00 committed by Gitea
commit 45a22c2dd4
Signed by: Gitea
GPG Key ID: 7B89B83EED9AD2C6
4 changed files with 9 additions and 10 deletions

View File

@ -10,7 +10,7 @@
}
],
"require": {
"esoko/soko-web": "0.1",
"esoko/soko-web": "0.2.1",
"firebase/php-jwt": "^6.4"
},
"require-dev": {

8
composer.lock generated
View File

@ -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",

View File

@ -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()) {

View File

@ -86,6 +86,7 @@ Container::$request = new SokoWeb\Request\Request(
$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
$_GET,
$_POST,
getallheaders(),
$_SESSION,
new RVR\Repository\UserRepository()
);