From 9040e6c2fea11ced35fabe64de31904b96bbdde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 May 2020 19:25:02 +0200 Subject: [PATCH 1/5] Allow symfony 5 in composer.json --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3dda954..8b60160 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,10 @@ "doctrine/common": "*", "scheb/two-factor-bundle": "^3.2.0|^4.0.0", "yubico/u2flib-server": "^1.0.0", - "symfony/framework-bundle": "^3.4|^4.0", + "symfony/framework-bundle": "^3.4|^4.0|^5.0", "symfony/templating": "^3.4|^4.0", - "doctrine/collections": "^1.6" + "doctrine/collections": "^1.6", + "symfony/event-dispatcher-contracts": "^2.0" }, "conflict": { "tubssz/u2f-two-factor-bundle": "*", From 29e3d7cc64ac08703ad634c14417e4e7dfd9f5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 May 2020 19:26:55 +0200 Subject: [PATCH 2/5] Fixed route definition: Use new format for Controller actions. --- Resources/config/routing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index eb14b13..8fde3a6 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -1,3 +1,3 @@ club_base_register_u2f: path: /u2f_register - defaults: { _controller: RU2FTwoFactorBundle:Register:u2f } + defaults: { _controller: R\U2FTwoFactorBundle\Controller\RegisterController::u2fAction } From c994f25151c8ffce10010ab5fcc35cf998015fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 May 2020 19:32:36 +0200 Subject: [PATCH 3/5] Inject Container via service constructor, to prevent exception. Otherwise a '"R\U2FTwoFactorBundle\Controller\RegisterController" has no container set, did you forget to define it as a service subscriber?' is thrown. --- Controller/RegisterController.php | 3 +++ Resources/config/services.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/Controller/RegisterController.php b/Controller/RegisterController.php index 2731517..c905ff1 100644 --- a/Controller/RegisterController.php +++ b/Controller/RegisterController.php @@ -4,6 +4,7 @@ use R\U2FTwoFactorBundle\Event\RegisterEvent; use R\U2FTwoFactorBundle\Security\TwoFactor\Provider\U2F\U2FAuthenticator; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -30,12 +31,14 @@ public function __construct( U2FAuthenticator $u2fAuthenticator, SessionInterface $session, EventDispatcherInterface $eventDispatcher, + ContainerInterface $container, string $registerTemplate ) { $this->u2fAuthenticator = $u2fAuthenticator; $this->session = $session; $this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher); $this->registerTemplate = $registerTemplate; + $this->container = $container; } public function u2fAction(Request $request): Response diff --git a/Resources/config/services.yml b/Resources/config/services.yml index dd3505b..ad5b84d 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -22,5 +22,6 @@ services: arguments: $u2fAuthenticator: '@R\U2FTwoFactorBundle\Security\TwoFactor\Provider\U2F\U2FAuthenticator' $session: '@session' + $container: '@service_container' $eventDispatcher: '@event_dispatcher' $registerTemplate: '%r_u2f_two_factor.registerTemplate%' From 651491fb364ae108719212d1a0e6d54cc5af27d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 May 2020 19:39:45 +0200 Subject: [PATCH 4/5] Allow symfony 5.0 templating. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8b60160..cc2a01d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "scheb/two-factor-bundle": "^3.2.0|^4.0.0", "yubico/u2flib-server": "^1.0.0", "symfony/framework-bundle": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0", + "symfony/templating": "^3.4|^4.0|^5.0", "doctrine/collections": "^1.6", "symfony/event-dispatcher-contracts": "^2.0" }, From 934e1c98e0dc7ef9ce731f9dfe87d5b86a38d9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 10 May 2020 19:45:27 +0200 Subject: [PATCH 5/5] Use Event-Dispatcher contracts Event class. --- Event/RegisterEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Event/RegisterEvent.php b/Event/RegisterEvent.php index 1991b6c..8eb4d44 100644 --- a/Event/RegisterEvent.php +++ b/Event/RegisterEvent.php @@ -2,7 +2,7 @@ namespace R\U2FTwoFactorBundle\Event; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; use Symfony\Component\HttpFoundation\Response; use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface; use u2flib_server\Registration;