FIX: Authorization en FastCGI
This commit is contained in:
@ -8,7 +8,7 @@ use Incoviba\Exception\Client\FastCGI as FastCGIException;
|
||||
|
||||
class FastCGI implements LoggerAwareInterface
|
||||
{
|
||||
public function __construct(protected string $hostname, protected int $port,
|
||||
public function __construct(protected Login $loginService, protected string $hostname, protected int $port,
|
||||
protected string $documentRoot,
|
||||
protected int $connectionTimeout = 5000, protected int $readTimeout = 5000)
|
||||
{
|
||||
@ -43,6 +43,7 @@ class FastCGI implements LoggerAwareInterface
|
||||
if (!isset($this->socket)) {
|
||||
$this->connect();
|
||||
}
|
||||
$request = $this->setHeaders($request);
|
||||
try {
|
||||
$this->socketIds []= $this->client->sendAsyncRequest($this->socket, $request);
|
||||
} catch (FCGI\Exceptions\FastCGIClientException $exception) {
|
||||
@ -97,4 +98,11 @@ class FastCGI implements LoggerAwareInterface
|
||||
$request->setRequestUri($uri);
|
||||
return $this->sendRequest($request);
|
||||
}
|
||||
|
||||
protected function setHeaders(FCGI\Interfaces\ProvidesRequestData $request): FCGI\Interfaces\ProvidesRequestData
|
||||
{
|
||||
$apiKey = $this->loginService->getKey();
|
||||
$request->setCustomVar('HTTP_AUTHORIZATION', "Bearer {$apiKey}");
|
||||
return $request;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user