Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,25 @@ class RegisterRoutes
$authenticatorConfig = [
'path' => '/',
'authenticator' => new ApiKeyAuthenticator,
'regex' => '/\s+(.*)$/i',
'regex' => '/\s*(.*)$/i',
'argument' => null,
'attribute' => 'authorization_token',
'error' => ['{{authPackage}}\ApiKeyAuthenticator', 'handleUnauthorized'],
];
if ($authMethod['isKeyInHeader']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => $authMethod['keyParamName'],
'parameter' => null,
'cookie' => null,
];
} else if ($authMethod['isKeyInQuery']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => null,
'parameter' => $authMethod['keyParamName'],
'cookie' => null,
];
} else if ($authMethod['isKeyInCookie']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => null,
'parameter' => null,
'cookie' => $authMethod['keyParamName'],
Expand Down
8 changes: 4 additions & 4 deletions samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -905,25 +905,25 @@ public function __invoke(\Slim\App $app): void
$authenticatorConfig = [
'path' => '/',
'authenticator' => new ApiKeyAuthenticator,
'regex' => '/\s+(.*)$/i',
'regex' => '/\s*(.*)$/i',
'argument' => null,
'attribute' => 'authorization_token',
'error' => ['OpenAPIServer\Auth\ApiKeyAuthenticator', 'handleUnauthorized'],
];
if ($authMethod['isKeyInHeader']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => $authMethod['keyParamName'],
'parameter' => null,
'cookie' => null,
];
} else if ($authMethod['isKeyInQuery']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => null,
'parameter' => $authMethod['keyParamName'],
'cookie' => null,
];
} else if ($authMethod['isKeyInCookie']) {
$authenticatorConfig = [
$authenticatorConfig += [
'header' => null,
'parameter' => null,
'cookie' => $authMethod['keyParamName'],
Expand Down
Loading