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
|
||||
{
|
||||
$this->logger->critical(var_export([$this->service->isIn(), $this->isValid($request)],true));
|
||||
if ($this->service->isIn() or $this->isValid($request)) {
|
||||
return $handler->handle($request);
|
||||
}
|
||||
@ -45,13 +46,15 @@ class Authentication
|
||||
]);
|
||||
|
||||
$valid_paths = [
|
||||
'/',
|
||||
'/api'
|
||||
'/'
|
||||
];
|
||||
if (in_array($current_path, $valid_paths, true)) {
|
||||
return true;
|
||||
}
|
||||
foreach ($valid_paths as $path) {
|
||||
$valid_subpaths = [
|
||||
'/api'
|
||||
];
|
||||
foreach ($valid_subpaths as $path) {
|
||||
if (str_starts_with($current_path, $path)) {
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user