diff --git a/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php b/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php index 1503d7ff1a6..7c81a961009 100644 --- a/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php +++ b/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php @@ -905,25 +905,25 @@ class RegisterRoutes $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'],