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 = [
'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'],