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