More granular control of external validation configuration
This commit is contained in:
@ -85,6 +85,13 @@ class API
|
||||
}
|
||||
protected function validateExternalKey(ServerRequestInterface $request, $basePath, $subPath): bool
|
||||
{
|
||||
$data = $this->externalPaths[$basePath][$subPath];
|
||||
if (isset($data['header']) and $request->hasHeader($data['header'])) {
|
||||
$token = $request->getHeaderLine($data['header']);
|
||||
if ($token === $this->externalPaths[$basePath][$subPath]['token']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($request->hasHeader('x-api-key')) {
|
||||
$key = $request->getHeaderLine('x-api-key');
|
||||
if ($key === $this->externalPaths[$basePath][$subPath]) {
|
||||
|
Reference in New Issue
Block a user