Validate with service

This commit is contained in:
Juan Pablo Vial
2025-05-29 19:43:06 -04:00
parent b4159d1417
commit f399eb8d47
3 changed files with 12 additions and 1 deletions

View File

@ -86,6 +86,10 @@ class API
protected function validateExternalKey(ServerRequestInterface $request, $basePath, $subPath): bool
{
$data = $this->externalPaths[$basePath][$subPath];
if (isset($data['validator'])) {
$method = [$data['validator'], 'validateToken'];
return $method($request, $data['token']);
}
if (isset($data['header']) and $request->hasHeader($data['header'])) {
$token = $request->getHeaderLine($data['header']);
if ($token === $this->externalPaths[$basePath][$subPath]['token']) {