Issue 21958 php-slim4 throws exception (#21962)

authenticatorConfig was being overwritten instead of having additional fields added.
Changed the reqex from requiring leading whitespace to having it optional.
This commit is contained in:
Kevin 2025-09-19 02:25:41 -04:00 committed by GitHub
parent 1c950018c8
commit ec0edf433a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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'],