From c2ab5ad2dcdb770f11f6fb5b0b74d6294402e323 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 14 Sep 2025 10:20:20 -0400 Subject: [PATCH 1/2] Issue 21958 php-slim4 throws exception authenticatorConfig was being overwritten instead of having additional fields added. Changed the reqex from requiring leading whitespace to having it optional. --- .../resources/php-slim4-server/register_routes.mustache | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache index fcf59e8aaf38..527bdb3380f5 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache @@ -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'], From 0ba1e46467a404d5801fbcda93b5a271b4df02c1 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 19 Sep 2025 14:19:11 +0800 Subject: [PATCH 2/2] update samples --- .../server/petstore/php-slim4/lib/App/RegisterRoutes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php b/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php index 1503d7ff1a68..7c81a961009e 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 @@ 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'],