Skip to content

Commit

Permalink
Fix vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Mátyus committed Apr 18, 2024
1 parent 529e751 commit 2df8690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/Component/ApiConsoleControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ public function formSucceeded(Form $form, ArrayHash $values): void

if ($this->authorization instanceof MultiAuthorizator) {
foreach ($this->authorization->getAuthorizators() as $authorization) {
$this->addAdditionalValues($authorization, $additionalValues);
$this->addAdditionalValues($authorization, $values, $additionalValues);
}
} else {
$this->addAdditionalValues($authorization, $additionalValues);
$this->addAdditionalValues($this->authorization, $values, $additionalValues);
}

$consoleRequest = new ConsoleRequest($this->handler, $this->endpoint, $this->apiLink);
Expand Down Expand Up @@ -208,7 +208,7 @@ private function addFormularItems(Form $form, ApiAuthorizationInterface $authori
$form->addText('basic_authentication_password', 'Password')
->setHtmlAttribute('placeholder', 'Enter basic authentication password');
} elseif ($authorization instanceof QueryApiKeyAuthentication) {
$form->addText($this->authorization->getQueryParamName(), 'API key')
$form->addText($authorization->getQueryParamName(), 'API key')
->setHtmlAttribute('placeholder', 'Enter API key');
} elseif ($authorization instanceof HeaderApiKeyAuthentication) {
$form->addText('header_api_key', 'API key')
Expand All @@ -223,16 +223,16 @@ private function addFormularItems(Form $form, ApiAuthorizationInterface $authori
}
}

private function addAdditionalValues(ApiAuthorizationInterface $authorization, &$additionalValues): void
private function addAdditionalValues(ApiAuthorizationInterface $authorization, ArrayHash $values, &$additionalValues): void
{
if ($this->authorization instanceof QueryApiKeyAuthentication) {
$queryParamName = $this->authorization->getQueryParamName();
if ($authorization instanceof QueryApiKeyAuthentication) {
$queryParamName = $authorization->getQueryParamName();
$additionalValues['getFields'][$queryParamName] = $values[$queryParamName] ?? null;
} elseif ($this->authorization instanceof HeaderApiKeyAuthentication) {
$headerName = $this->authorization->getHeaderName();
} elseif ($authorization instanceof HeaderApiKeyAuthentication) {
$headerName = $authorization->getHeaderName();
$additionalValues['headers'][] = $headerName . ':' . $values['header_api_key'] ?? null;
} elseif ($this->authorization instanceof CookieApiKeyAuthentication) {
$cookieName = $this->authorization->getCookieName();
} elseif ($authorization instanceof CookieApiKeyAuthentication) {
$cookieName = $authorization->getCookieName();
$additionalValues['cookieFields'][$cookieName] = $values['cookie_api_key'] ?? null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Handlers/OpenApiHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function handle(array $params): ResponseInterface
$authorization = $api->getAuthorization();

if ($authorization instanceof MultiAuthorizator) {
foreach ($this->authorization->getAuthorizators() as $tmpAuthorization) {
foreach ($authorization->getAuthorizators() as $tmpAuthorization) {
$this->addSecuritySchema($tmpAuthorization, $securitySchemes);
}
} else {
Expand Down

0 comments on commit 2df8690

Please sign in to comment.