Skip to content

Commit c2ab5ad

Browse files
committed
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.
1 parent 6b69273 commit c2ab5ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/openapi-generator/src/main/resources/php-slim4-server/register_routes.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,25 @@ class RegisterRoutes
197197
$authenticatorConfig = [
198198
'path' => '/',
199199
'authenticator' => new ApiKeyAuthenticator,
200-
'regex' => '/\s+(.*)$/i',
200+
'regex' => '/\s*(.*)$/i',
201201
'argument' => null,
202202
'attribute' => 'authorization_token',
203203
'error' => ['{{authPackage}}\ApiKeyAuthenticator', 'handleUnauthorized'],
204204
];
205205
if ($authMethod['isKeyInHeader']) {
206-
$authenticatorConfig = [
206+
$authenticatorConfig += [
207207
'header' => $authMethod['keyParamName'],
208208
'parameter' => null,
209209
'cookie' => null,
210210
];
211211
} else if ($authMethod['isKeyInQuery']) {
212-
$authenticatorConfig = [
212+
$authenticatorConfig += [
213213
'header' => null,
214214
'parameter' => $authMethod['keyParamName'],
215215
'cookie' => null,
216216
];
217217
} else if ($authMethod['isKeyInCookie']) {
218-
$authenticatorConfig = [
218+
$authenticatorConfig += [
219219
'header' => null,
220220
'parameter' => null,
221221
'cookie' => $authMethod['keyParamName'],

0 commit comments

Comments
 (0)