update php samples

This commit is contained in:
William Cheng 2025-09-19 14:28:41 +08:00
parent ec0edf433a
commit a55525c634

View File

@ -905,25 +905,25 @@ class RegisterRoutes
$authenticatorConfig = [ $authenticatorConfig = [
'path' => '/', 'path' => '/',
'authenticator' => new ApiKeyAuthenticator, 'authenticator' => new ApiKeyAuthenticator,
'regex' => '/\s+(.*)$/i', 'regex' => '/\s*(.*)$/i',
'argument' => null, 'argument' => null,
'attribute' => 'authorization_token', 'attribute' => 'authorization_token',
'error' => ['OpenAPIServer\Auth\ApiKeyAuthenticator', 'handleUnauthorized'], 'error' => ['OpenAPIServer\Auth\ApiKeyAuthenticator', 'handleUnauthorized'],
]; ];
if ($authMethod['isKeyInHeader']) { if ($authMethod['isKeyInHeader']) {
$authenticatorConfig = [ $authenticatorConfig += [
'header' => $authMethod['keyParamName'], 'header' => $authMethod['keyParamName'],
'parameter' => null, 'parameter' => null,
'cookie' => null, 'cookie' => null,
]; ];
} else if ($authMethod['isKeyInQuery']) { } else if ($authMethod['isKeyInQuery']) {
$authenticatorConfig = [ $authenticatorConfig += [
'header' => null, 'header' => null,
'parameter' => $authMethod['keyParamName'], 'parameter' => $authMethod['keyParamName'],
'cookie' => null, 'cookie' => null,
]; ];
} else if ($authMethod['isKeyInCookie']) { } else if ($authMethod['isKeyInCookie']) {
$authenticatorConfig = [ $authenticatorConfig += [
'header' => null, 'header' => null,
'parameter' => null, 'parameter' => null,
'cookie' => $authMethod['keyParamName'], 'cookie' => $authMethod['keyParamName'],