FIX: Auth had all paths starting with slash as valid
This commit is contained in:
@ -20,6 +20,7 @@ class Authentication
|
|||||||
|
|
||||||
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||||
{
|
{
|
||||||
|
$this->logger->critical(var_export([$this->service->isIn(), $this->isValid($request)],true));
|
||||||
if ($this->service->isIn() or $this->isValid($request)) {
|
if ($this->service->isIn() or $this->isValid($request)) {
|
||||||
return $handler->handle($request);
|
return $handler->handle($request);
|
||||||
}
|
}
|
||||||
@ -45,13 +46,15 @@ class Authentication
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$valid_paths = [
|
$valid_paths = [
|
||||||
'/',
|
'/'
|
||||||
'/api'
|
|
||||||
];
|
];
|
||||||
if (in_array($current_path, $valid_paths, true)) {
|
if (in_array($current_path, $valid_paths, true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
foreach ($valid_paths as $path) {
|
$valid_subpaths = [
|
||||||
|
'/api'
|
||||||
|
];
|
||||||
|
foreach ($valid_subpaths as $path) {
|
||||||
if (str_starts_with($current_path, $path)) {
|
if (str_starts_with($current_path, $path)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user