Skip to content

Commit

Permalink
SUPPORT-91253: code review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maruf-paysera committed Mar 4, 2024
1 parent b4c6fd6 commit 1eaf778
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Listener/BearerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Paysera\BearerAuthenticationBundle\Security\Token\BearerToken;
Expand Down Expand Up @@ -35,7 +35,7 @@ public function __construct(
$this->logger = $logger;
}

public function handle(GetResponseEvent $event): void
public function handle(KernelEvent $event): void
{
$request = $event->getRequest();
$this->fixAuthHeader($request->headers);
Expand Down
8 changes: 7 additions & 1 deletion src/PayseraBearerAuthenticationBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public function build(ContainerBuilder $container): void
parent::build($container);

$extension = $container->getExtension('security');
$extension->addAuthenticatorFactory(new BearerFactory());
if (method_exists($extension, 'addAuthenticatorFactory')) {
$extension->addAuthenticatorFactory(new BearerFactory());
}

if (method_exists($extension, 'addSecurityListenerFactory')) {
$extension->addSecurityListenerFactory(new BearerFactory());
}

$container->addCompilerPass(new AddTaggedCompilerPass(
'paysera_bearer_authentication.security_user.bearer_user_provider',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Paysera\BearerAuthenticationBundle\Security\Token;
namespace Paysera\BearerAuthenticationBundle\Security\Authentication\Token;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Security/Provider/BearerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Paysera\BearerAuthenticationBundle\Security\Provider;

use Paysera\BearerAuthenticationBundle\Entity\BearerUserInterface;
use Paysera\BearerAuthenticationBundle\Security\Token\BearerTokenInterface;
use Paysera\BearerAuthenticationBundle\Security\Authentication\Token\BearerTokenInterface;
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
Expand Down
1 change: 1 addition & 0 deletions src/Security/Token/BearerToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Paysera\BearerAuthenticationBundle\Security\Token;

use Paysera\BearerAuthenticationBundle\Security\Authentication\Token\BearerTokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;

class BearerToken extends AbstractToken implements BearerTokenInterface
Expand Down

0 comments on commit 1eaf778

Please sign in to comment.