[Security] Access Token Authenticator

by @Spomky

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/46428/c9afba4ba58e6aa8ba6d83cc5de471bfa1d2abc5/cs.diff | patch -p0
diff -ru src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AccessTokenFactory.php src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AccessTokenFactory.php
--- src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AccessTokenFactory.php	2022-06-22 15:46:04.466872635 +0000
+++ src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AccessTokenFactory.php	2022-06-22 15:46:11.016011754 +0000
@@ -98,13 +98,13 @@
      */
     private function createExtractor(ContainerBuilder $container, string $firewallName, array $extractors): string
     {
-        if (count($extractors) === 1) {
+        if (1 === \count($extractors)) {
             return current($extractors);
         }
         $extractorId = sprintf('security.authenticator.access_token.chain_extractor.%s', $firewallName);
         $container
             ->setDefinition($extractorId, new ChildDefinition('security.authenticator.access_token.chain_extractor'))
-            ->replaceArgument(0, array_map(function (string $extractorId): Reference {return new Reference($extractorId);}, $extractors))
+            ->replaceArgument(0, array_map(function (string $extractorId): Reference {return new Reference($extractorId); }, $extractors))
         ;
 
         return $extractorId;
diff -ru src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php
--- src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php	2022-06-22 15:46:04.859880984 +0000
+++ src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator_access_token.php	2022-06-22 15:46:17.271144628 +0000
@@ -11,7 +11,6 @@
 
 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
 
-use Psr\Log\LoggerInterface;
 use Symfony\Component\Security\Http\Authenticator\AccessToken\AccessTokenAuthenticator;
 use Symfony\Component\Security\Http\Authenticator\AccessToken\ChainAccessTokenExtractor;
 use Symfony\Component\Security\Http\Authenticator\AccessToken\FormEncodedBodyExtractor;
@@ -42,5 +41,4 @@
             abstract_arg('access token extractors'),
         ])
     ;
-    ;
 };
diff -ru src/Symfony/Component/Security/Http/Authenticator/AccessToken/AccessTokenAuthenticator.php src/Symfony/Component/Security/Http/Authenticator/AccessToken/AccessTokenAuthenticator.php
--- src/Symfony/Component/Security/Http/Authenticator/AccessToken/AccessTokenAuthenticator.php	2022-06-22 15:46:09.658982928 +0000
+++ src/Symfony/Component/Security/Http/Authenticator/AccessToken/AccessTokenAuthenticator.php	2022-06-22 15:46:19.858199583 +0000
@@ -41,7 +41,7 @@
         private readonly AccessTokenHandlerInterface $accessTokenHandler,
         private readonly AccessTokenExtractorInterface $accessTokenExtractor,
         private readonly ?AuthenticationSuccessHandlerInterface $successHandler = null,
-        ?AuthenticationFailureHandlerInterface $failureHandler = null,
+        AuthenticationFailureHandlerInterface $failureHandler = null,
         string $realm = null,
     ) {
         $this->failureHandler = $failureHandler ?? new DefaultAuthenticationFailureHandler($realm);
diff -ru src/Symfony/Component/Security/Http/Authenticator/AccessToken/ChainAccessTokenExtractor.php src/Symfony/Component/Security/Http/Authenticator/AccessToken/ChainAccessTokenExtractor.php
--- src/Symfony/Component/Security/Http/Authenticator/AccessToken/ChainAccessTokenExtractor.php	2022-06-22 15:46:10.228995036 +0000
+++ src/Symfony/Component/Security/Http/Authenticator/AccessToken/ChainAccessTokenExtractor.php	2022-06-22 15:46:19.993202451 +0000
@@ -25,7 +25,8 @@
      */
     public function __construct(
         private readonly iterable $accessTokenExtractors,
-    ) {}
+    ) {
+    }
 
     public function extractAccessToken(Request $request): ?string
     {

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
JSON Files Syntax

0
YAML Files Syntax

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages