No usar schema para revision de url

This commit is contained in:
Juan Pablo Vial
2024-10-25 18:33:50 -03:00
parent 389e60980e
commit 4894809105

View File

@ -1,6 +1,7 @@
<?php
namespace Incoviba\Middleware;
use GuzzleHttp\Psr7\Uri;
use Incoviba\Common\Alias\View;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
@ -39,7 +40,6 @@ class Authentication
$uri = $request->getUri();
$current_path = $uri->getPath();
$current_url = implode('', [
"{$uri->getScheme()}://",
$uri->getHost() . ($uri->getPort() !== null ? ":{$uri->getPort()}" : ''),
$uri->getPath()
]);
@ -58,9 +58,14 @@ class Authentication
return true;
}
}
$login = new Uri($this->login_url);
$login_url = implode('', [
$login->getHost() . ($login->getPort() !== null ? ":{$login->getPort()}" : ''),
$login->getPath()
]);
$valid_uris = [
$this->login_url,
"{$this->login_url}/",
$login_url,
"{$login_url}/",
];
if (in_array($current_url, $valid_uris, true)) {
return true;