From 9cc6d97d8576cbcefed5a475e0d522c130cea37b Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 07:35:33 +0100 Subject: [PATCH 01/28] Allow Symfony 6 --- EventListener/ExceptionEventListener.php | 4 ++- EventListener/MainRequestTrait.php | 27 +++++++++++++++++++ EventListener/RequestEventListener.php | 6 +++-- composer.json | 34 ++++++++++++------------ 4 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 EventListener/MainRequestTrait.php diff --git a/EventListener/ExceptionEventListener.php b/EventListener/ExceptionEventListener.php index ad98e79..661f316 100644 --- a/EventListener/ExceptionEventListener.php +++ b/EventListener/ExceptionEventListener.php @@ -22,10 +22,12 @@ */ final class ExceptionEventListener { + use MainRequestTrait; + public function onKernelException(KernelEvent $event): void { $exception = method_exists($event, 'getThrowable') ? $event->getThrowable() : $event->getException(); - if (!$event->isMasterRequest() || !$exception instanceof JsonHttpExceptionInterface) { + if (!$this->isMainRequest($event) || !$exception instanceof JsonHttpExceptionInterface) { return; } diff --git a/EventListener/MainRequestTrait.php b/EventListener/MainRequestTrait.php new file mode 100644 index 0000000..ad24eb2 --- /dev/null +++ b/EventListener/MainRequestTrait.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace CoopTilleuls\ForgotPasswordBundle\EventListener; + +use Symfony\Component\HttpKernel\Event\KernelEvent; + +/** + * @author Jon Gotlin + */ +trait MainRequestTrait +{ + protected function isMainRequest(KernelEvent $event): bool + { + return method_exists($event, 'isMainRequest') ? $event->isMainRequest() : $event->isMasterRequest(); + } +} diff --git a/EventListener/RequestEventListener.php b/EventListener/RequestEventListener.php index c44dacc..e2dc908 100755 --- a/EventListener/RequestEventListener.php +++ b/EventListener/RequestEventListener.php @@ -26,6 +26,8 @@ */ final class RequestEventListener { + use MainRequestTrait; + private $authorizedFields; private $userPasswordField; private $passwordTokenManager; @@ -47,7 +49,7 @@ public function decodeRequest(KernelEvent $event): void { $request = $event->getRequest(); $routeName = $request->attributes->get('_route'); - if (!$event->isMasterRequest() || !\in_array( + if (!$this->isMainRequest($event) || !\in_array( $routeName, ['coop_tilleuls_forgot_password.reset', 'coop_tilleuls_forgot_password.update'], true ) @@ -88,7 +90,7 @@ public function getTokenFromRequest(KernelEvent $event): void { $request = $event->getRequest(); $routeName = $request->attributes->get('_route'); - if (!$event->isMasterRequest() || !\in_array( + if (!$this->isMainRequest($event) || !\in_array( $routeName, ['coop_tilleuls_forgot_password.get_token', 'coop_tilleuls_forgot_password.update'], true ) diff --git a/composer.json b/composer.json index 3703f90..01dd6c7 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,12 @@ "require": { "php": ">=7.2", "ircmaxell/random-lib": "^1.2", - "symfony/config": "^3.4 || ^4.4 || ^5.1", - "symfony/dependency-injection": "^3.4.26 || ^4.4 || ^5.1", - "symfony/event-dispatcher": "^3.4 || ^4.4 || ^5.1", - "symfony/http-foundation": "^3.4.35 || ^4.4.7 || ^5.1", - "symfony/http-kernel": "^3.4.35 || ^4.4.13 || ^5.1.5", - "symfony/serializer": "^3.4 || ^4.4 || ^5.1" + "symfony/config": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/dependency-injection": "^3.4.26 || ^4.4 || ^5.1 || ^6.0", + "symfony/event-dispatcher": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/http-foundation": "^3.4.35 || ^4.4.7 || ^5.1 || ^6.0", + "symfony/http-kernel": "^3.4.35 || ^4.4.13 || ^5.1.5 || ^6.0", + "symfony/serializer": "^3.4 || ^4.4 || ^5.1 || ^6.0" }, "require-dev": { "api-platform/core": "^2.3", @@ -39,17 +39,17 @@ "ocramius/proxy-manager": "^2.0.4", "phpspec/prophecy": "^1.10", "sebastian/comparator": "^3.0", - "symfony/asset": "^3.4 || ^4.4 || ^5.1", - "symfony/browser-kit": "^3.4 || ^4.4 || ^5.1", - "symfony/framework-bundle": "^3.4.26 || ^4.4 || ^5.1", - "symfony/mailer": "^4.4 || ^5.1", - "symfony/phpunit-bridge": "^5.1", - "symfony/property-access": "^3.4 || ^4.4 || ^5.1", - "symfony/security-bundle": "^3.4.11 || ^4.4 || ^5.1", - "symfony/stopwatch": "^3.4 || ^4.4 || ^5.1", - "symfony/templating": "^3.4 || ^4.4 || ^5.1", - "symfony/twig-bundle": "^3.4 || ^4.4 || ^5.1", - "symfony/var-dumper": "^3.4 || ^4.4 || ^5.1" + "symfony/asset": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/browser-kit": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/framework-bundle": "^3.4.26 || ^4.4 || ^5.1 || ^6.0", + "symfony/mailer": "^4.4 || ^5.1 || ^6.0", + "symfony/phpunit-bridge": "^5.1 || ^6.0", + "symfony/property-access": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/security-bundle": "^3.4.11 || ^4.4 || ^5.1 || ^6.0", + "symfony/stopwatch": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/templating": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/twig-bundle": "^3.4 || ^4.4 || ^5.1 || ^6.0", + "symfony/var-dumper": "^3.4 || ^4.4 || ^5.1 || ^6.0" }, "suggest": { "doctrine/doctrine-bundle": "To connect with Doctrine in Symfony project", From 2c6d04029ae1565e6d2163d49ec01255b413350d Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:15:56 +0100 Subject: [PATCH 02/28] Update test to handle both isMainRequest and legacy isMasterRequest --- .../ExceptionEventListenerTest.php | 19 ++++-- .../RequestEventListenerTest.php | 61 ++++++++++++++++--- 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/tests/EventListener/ExceptionEventListenerTest.php b/tests/EventListener/ExceptionEventListenerTest.php index a6d1a3c..28c9b9c 100644 --- a/tests/EventListener/ExceptionEventListenerTest.php +++ b/tests/EventListener/ExceptionEventListenerTest.php @@ -39,7 +39,11 @@ public function testOnKernelExceptionInvalid(): void $eventMock->getException()->willReturn($this->prophesize(\Exception::class)->reveal())->shouldBeCalledTimes(1); } - $eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(ExceptionEvent::class, 'isMainRequest')) { + $eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $eventMock->setResponse(Argument::any())->shouldNotBeCalled(); $listener = new ExceptionEventListener(); @@ -56,7 +60,11 @@ public function testOnKernelExceptionSubRequest(): void $eventMock->getException()->willReturn($this->prophesize(\Exception::class)->reveal())->shouldBeCalledTimes(1); } - $eventMock->isMasterRequest()->willReturn(false)->shouldBeCalledTimes(1); + if (method_exists(ExceptionEvent::class, 'isMainRequest')) { + $eventMock->isMainRequest()->willReturn(false)->shouldBeCalledTimes(1); + } else { + $eventMock->isMasterRequest()->willReturn(false)->shouldBeCalledTimes(1); + } $eventMock->setResponse(Argument::any())->shouldNotBeCalled(); $listener = new ExceptionEventListener(); @@ -76,8 +84,11 @@ public function testOnKernelException(): void $eventMock = $this->prophesize(GetResponseForExceptionEvent::class); $eventMock->getException()->willReturn($exception)->shouldBeCalledTimes(1); } - - $eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(ExceptionEvent::class, 'isMainRequest')) { + $eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $eventMock->setResponse( Argument::that( function ($response) { diff --git a/tests/EventListener/RequestEventListenerTest.php b/tests/EventListener/RequestEventListenerTest.php index 6417d23..eb97898 100644 --- a/tests/EventListener/RequestEventListenerTest.php +++ b/tests/EventListener/RequestEventListenerTest.php @@ -63,7 +63,11 @@ protected function setUp(): void public function testDecodeRequestInvalidRoute(): void { $this->parameterBagMock->get('_route')->willReturn('foo')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->shouldNotBeCalled(); $this->listener->decodeRequest($this->eventMock->reveal()); @@ -75,7 +79,11 @@ public function testDecodeRequestMissingFieldException(): void $this->expectExceptionMessage('Parameter "password" is missing.'); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->willReturn(json_encode(['password' => '']))->shouldBeCalledTimes(1); $this->listener->decodeRequest($this->eventMock->reveal()); @@ -87,7 +95,11 @@ public function testDecodeRequestNoParametersException(): void $this->expectExceptionMessage('No parameter sent.'); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->willReturn('{}')->shouldBeCalledTimes(1); $this->listener->decodeRequest($this->eventMock->reveal()); @@ -99,7 +111,12 @@ public function testDecodeRequestInvalidJsonHttpException(): void $this->expectExceptionMessage('Invalid JSON data.'); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } + $this->requestMock->getContent()->willReturn('{')->shouldBeCalledTimes(1); $this->listener->decodeRequest($this->eventMock->reveal()); @@ -111,7 +128,11 @@ public function testDecodeRequestUnauthorizedException(): void $this->expectExceptionMessage('The parameter "name" is not authorized in your configuration.'); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.reset')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->willReturn(json_encode(['name' => 'foo']))->shouldBeCalledTimes(1); $this->listener->decodeRequest($this->eventMock->reveal()); @@ -120,7 +141,11 @@ public function testDecodeRequestUnauthorizedException(): void public function testDecodeRequest(): void { $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->willReturn(json_encode(['password' => 'bar']))->shouldBeCalledTimes(1); $this->parameterBagMock->set('password', 'bar')->shouldBeCalledTimes(1); @@ -130,7 +155,11 @@ public function testDecodeRequest(): void public function testGetTokenFromRequestInvalidRoute(): void { $this->parameterBagMock->get('_route')->willReturn('foo')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->requestMock->getContent()->shouldNotBeCalled(); $this->listener->getTokenFromRequest($this->eventMock->reveal()); @@ -141,7 +170,11 @@ public function testGetTokenFromRequestNoTokenException(): void $this->expectException(NotFoundHttpException::class); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->parameterBagMock->get('tokenValue')->willReturn('foo')->shouldBeCalledTimes(1); $this->managerMock->findOneByToken('foo')->shouldBeCalledTimes(1); @@ -155,7 +188,11 @@ public function testGetTokenFromRequestInvalidTokenException(): void $tokenMock = $this->prophesize(AbstractPasswordToken::class); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->parameterBagMock->get('tokenValue')->willReturn('foo')->shouldBeCalledTimes(1); $this->managerMock->findOneByToken('foo')->willReturn($tokenMock->reveal())->shouldBeCalledTimes(1); $tokenMock->isExpired()->willReturn(true)->shouldBeCalledTimes(1); @@ -168,7 +205,11 @@ public function testGetTokenFromRequest(): void $tokenMock = $this->prophesize(AbstractPasswordToken::class); $this->parameterBagMock->get('_route')->willReturn('coop_tilleuls_forgot_password.update')->shouldBeCalledTimes(1); - $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + if (method_exists(KernelEvent::class, 'isMainRequest')) { + $this->eventMock->isMainRequest()->willReturn(true)->shouldBeCalledTimes(1); + } else { + $this->eventMock->isMasterRequest()->willReturn(true)->shouldBeCalledTimes(1); + } $this->parameterBagMock->get('tokenValue')->willReturn('foo')->shouldBeCalledTimes(1); $this->managerMock->findOneByToken('foo')->willReturn($tokenMock->reveal())->shouldBeCalledTimes(1); $tokenMock->isExpired()->willReturn(false)->shouldBeCalledTimes(1); From 9a3e1b709113a46071d74760231fcd6a1ee92940 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:16:31 +0100 Subject: [PATCH 03/28] Test with Symfony 6.0 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bcd6ee..8618773 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: symfony: - '4.4.*' - '5.3.*' + - '6.0.*' include: - php: '8.0' symfony: '5.3.*' From 71a477d773a597d9cf7fcad2657682ebf3b8b774 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:26:04 +0100 Subject: [PATCH 04/28] Dont test sf 6.0 on php 7.x --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8618773..472dd42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,10 @@ jobs: exclude: - php: '8.0' symfony: '4.4.*' + - php: '7.3' + symfony: '6.0.*' + - php: '7.4' + symfony: '6.0.*' fail-fast: false steps: - name: Checkout From 3dfef830a7e42e6eb520ddd1c3f4eb633b6ed814 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:31:15 +0100 Subject: [PATCH 05/28] Accept jms serializer 4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 01dd6c7..f7210e0 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "doctrine/orm": "^2.6.3", "egulias/email-validator": "^2.1.10", "friends-of-behat/symfony-extension": "^2.0.11 || ^2.1.0", - "jms/serializer-bundle": "^1.4 || ^2.3 || ^3.0", + "jms/serializer-bundle": "^1.4 || ^2.3 || ^3.0 || ^4.0", "laminas/laminas-code": "^3.4", "ocramius/proxy-manager": "^2.0.4", "phpspec/prophecy": "^1.10", From b0dabd74e1d0fb53ec1861f992dd323d5d83a34f Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:36:26 +0100 Subject: [PATCH 06/28] CS fixer can run on php 7.3 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 472dd42..35145de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,8 @@ jobs: composer req --ignore-platform-reqs tilleuls/forgot-password-bundle:dev-${GITHUB_REF#refs/heads/} - name: Run php-cs-fixer tests run: php-cs-fixer fix --diff --dry-run + env: + PHP_CS_FIXER_IGNORE_ENV: 1 - name: Run PHPUnit tests run: vendor/bin/simple-phpunit --colors=always --testdox - name: Run Behat tests From c62b67abfafd5f99862f66a3a7fd12f0dc60a196 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 18 Jan 2022 08:39:03 +0100 Subject: [PATCH 07/28] Run CS fixer only on php 7.4+ --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35145de..66ce46a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,8 +70,7 @@ jobs: composer req --ignore-platform-reqs tilleuls/forgot-password-bundle:dev-${GITHUB_REF#refs/heads/} - name: Run php-cs-fixer tests run: php-cs-fixer fix --diff --dry-run - env: - PHP_CS_FIXER_IGNORE_ENV: 1 + if: matrix.php >= '7.4' - name: Run PHPUnit tests run: vendor/bin/simple-phpunit --colors=always --testdox - name: Run Behat tests From 1ff77a846abb901c7c38e4a04da6310745ca9557 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 18 Jan 2022 09:25:28 +0100 Subject: [PATCH 08/28] Private Co-authored-by: Vincent --- EventListener/MainRequestTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventListener/MainRequestTrait.php b/EventListener/MainRequestTrait.php index ad24eb2..ff152a1 100644 --- a/EventListener/MainRequestTrait.php +++ b/EventListener/MainRequestTrait.php @@ -20,7 +20,7 @@ */ trait MainRequestTrait { - protected function isMainRequest(KernelEvent $event): bool + private function isMainRequest(KernelEvent $event): bool { return method_exists($event, 'isMainRequest') ? $event->isMainRequest() : $event->isMasterRequest(); } From ed65f07bb101a8ba33b07358edcd23adf90373c7 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 18 Jan 2022 09:26:01 +0100 Subject: [PATCH 09/28] Minor bump Co-authored-by: Vincent --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66ce46a..cfe967f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - '8.0' symfony: - '4.4.*' - - '5.3.*' + - '5.4.*' - '6.0.*' include: - php: '8.0' From 16dbc74374e6d8d19e0a4f724bb0deca5e3b6672 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 18 Jan 2022 09:26:13 +0100 Subject: [PATCH 10/28] Minor bump Co-authored-by: Vincent --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfe967f..9bc8f3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - '6.0.*' include: - php: '8.0' - symfony: '5.3.*' + symfony: '5.4.*' bootable: true exclude: - php: '8.0' From 7b374d7655e3c04c3030c2d4c8f9c49a7fc6da0b Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 18 Jan 2022 09:26:20 +0100 Subject: [PATCH 11/28] Update .github/workflows/ci.yml Co-authored-by: Vincent --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bc8f3e..f1a834b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: composer req --ignore-platform-reqs tilleuls/forgot-password-bundle:dev-${GITHUB_REF#refs/heads/} - name: Run php-cs-fixer tests run: php-cs-fixer fix --diff --dry-run - if: matrix.php >= '7.4' + if: matrix.quality - name: Run PHPUnit tests run: vendor/bin/simple-phpunit --colors=always --testdox - name: Run Behat tests From a96e4852871f6cbf800981f97c72fe09ab0378e2 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 18 Jan 2022 09:26:27 +0100 Subject: [PATCH 12/28] Update .github/workflows/ci.yml Co-authored-by: Vincent --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1a834b..b414868 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: - php: '8.0' symfony: '5.4.*' bootable: true + quality: true exclude: - php: '8.0' symfony: '4.4.*' From 3ddbbee519044ae65a10bdf9a410ef3d683f62e9 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:00:28 +0100 Subject: [PATCH 13/28] Return type declaration --- Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php | 2 +- features/app/AppKernel.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php b/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php index 31ad36d..d23be39 100644 --- a/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php +++ b/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php @@ -154,7 +154,7 @@ public function normalize($object, $format = null, array $context = []) return $docs; } - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return $this->decorated->supportsNormalization($data, $format); } diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index e6e183e..74e7457 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -30,22 +30,22 @@ final class AppKernel extends Kernel { use MicroKernelTrait; - public function getCacheDir() + public function getCacheDir(): string { return __DIR__.'/cache/'.$this->getEnvironment(); } - public function getLogDir() + public function getLogDir(): string { return __DIR__.'/logs/'.$this->getEnvironment(); } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } - public function registerBundles() + public function registerBundles(): array { $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), From 764cda7f3adc9fd85027a4d79adb768ba16bbc84 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:02:02 +0100 Subject: [PATCH 14/28] Return type declaration --- Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php b/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php index d23be39..8c3d706 100644 --- a/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php +++ b/Bridge/ApiPlatform/Serializer/DocumentationNormalizer.php @@ -27,7 +27,7 @@ public function __construct(NormalizerInterface $decorated) $this->decorated = $decorated; } - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): array { $docs = $this->decorated->normalize($object, $format, $context); From fd2e37a36ebf63792832ea46bbb67276f6a311cf Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:10:48 +0100 Subject: [PATCH 15/28] Anonymous before Symfony 6 --- features/app/AppKernel.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 74e7457..27adf73 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -106,6 +106,10 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ], ])); + $mainFirewallBeforeSymfony6 = []; + if (AppKernel::VERSION_ID < 60000) { + $mainFirewallBeforeSymfony6 = ['anonymous' => true]; + } $c->loadFromExtension('security', [ 'encoders' => [UserInterface::class => 'plaintext'], 'providers' => [ @@ -121,9 +125,8 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'main' => [ 'pattern' => '^/', 'stateless' => true, - 'anonymous' => true, 'http_basic' => null, - ], + ] + $mainFirewallBeforeSymfony6, ], 'access_control' => [ ['path' => '^/forgot_password', 'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY'], From 0661298f352573b3d99e77804d348c92d196698e Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:13:00 +0100 Subject: [PATCH 16/28] Base kernel --- features/app/AppKernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 27adf73..14de9d7 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -107,7 +107,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ])); $mainFirewallBeforeSymfony6 = []; - if (AppKernel::VERSION_ID < 60000) { + if (Kernel::VERSION_ID < 60000) { $mainFirewallBeforeSymfony6 = ['anonymous' => true]; } $c->loadFromExtension('security', [ From 6df0f8cb65a70657b71117c5c9a7a9725241bb30 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:20:43 +0100 Subject: [PATCH 17/28] Password hasher config --- features/app/AppKernel.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 14de9d7..eef45cd 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; /** @@ -106,12 +107,20 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ], ])); - $mainFirewallBeforeSymfony6 = []; + $firewallExtra = []; + $passwordHashers = [ + 'password_hashers' => [ + PasswordAuthenticatedUserInterface::class => 'auto', + UserInterface::class => [ + 'algorithm' => 'plaintext', + ], + ], + ]; if (Kernel::VERSION_ID < 60000) { - $mainFirewallBeforeSymfony6 = ['anonymous' => true]; + $firewallExtra = ['anonymous' => true]; + $passwordHashers = ['encoders' => [UserInterface::class => 'plaintext']]; } - $c->loadFromExtension('security', [ - 'encoders' => [UserInterface::class => 'plaintext'], + $c->loadFromExtension('security', $passwordHashers + [ 'providers' => [ 'in_memory' => [ 'memory' => [ @@ -126,7 +135,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'pattern' => '^/', 'stateless' => true, 'http_basic' => null, - ] + $mainFirewallBeforeSymfony6, + ] + $firewallExtra, ], 'access_control' => [ ['path' => '^/forgot_password', 'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY'], From dd25f1a41553db875afb67755753ca405f55fc09 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:22:44 +0100 Subject: [PATCH 18/28] Return type declaration --- features/app/TestBundle/Entity/User.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/app/TestBundle/Entity/User.php b/features/app/TestBundle/Entity/User.php index 3560ff1..e00c3d9 100644 --- a/features/app/TestBundle/Entity/User.php +++ b/features/app/TestBundle/Entity/User.php @@ -112,8 +112,9 @@ public function setPassword($password): void /** * {@inheritdoc} */ - public function getRoles(): void + public function getRoles(): array { + return []; } /** From 50ca7239a302b881b1a77fe5fef7a775866e94b3 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:24:27 +0100 Subject: [PATCH 19/28] getUserIdentifier --- features/app/TestBundle/Entity/User.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/app/TestBundle/Entity/User.php b/features/app/TestBundle/Entity/User.php index e00c3d9..c05acfa 100644 --- a/features/app/TestBundle/Entity/User.php +++ b/features/app/TestBundle/Entity/User.php @@ -130,4 +130,9 @@ public function getSalt(): void public function eraseCredentials(): void { } + + public function getUserIdentifier(): string + { + return (string) $this->email; + } } From 392de817f8a04fe274bb07d83c62fface74c7424 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:30:35 +0100 Subject: [PATCH 20/28] No type hint --- features/app/AppKernel.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index eef45cd..f84acab 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -18,7 +18,6 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -64,7 +63,7 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes($routes): void { $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); } From 2cbbf6e303be5152da7ce0d891576ed0a130f10d Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:33:19 +0100 Subject: [PATCH 21/28] Revert --- features/app/AppKernel.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index f84acab..eef45cd 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -18,6 +18,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -63,7 +64,7 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes($routes): void + protected function configureRoutes(RouteCollectionBuilder $routes): void { $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); } From b27c7b6bdfc7c887ac0310c9fd8c899828057f25 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:34:51 +0100 Subject: [PATCH 22/28] Test remove --- features/app/AppKernel.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index eef45cd..9ffc2b7 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -64,11 +64,6 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes(RouteCollectionBuilder $routes): void - { - $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); - } - protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void { $c->loadFromExtension('coop_tilleuls_forgot_password', [ From 8fae15264302ffad54b9c9011445ffd933d040a8 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:37:43 +0100 Subject: [PATCH 23/28] Revert --- features/app/AppKernel.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 9ffc2b7..eef45cd 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -64,6 +64,11 @@ public function registerBundles(): array return $bundles; } + protected function configureRoutes(RouteCollectionBuilder $routes): void + { + $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); + } + protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void { $c->loadFromExtension('coop_tilleuls_forgot_password', [ From ee5fb5271711c45e4f5dfbe26ce440e2b7219166 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:37:56 +0100 Subject: [PATCH 24/28] RoutingConfigurator --- features/app/AppKernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index eef45cd..4ce2908 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -18,7 +18,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -64,7 +64,7 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes(RoutingConfigurator $routes): void { $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); } From 92ce63ca1d10f5fabd99d8d0ef3c07f492226d00 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 19 Jan 2022 20:39:42 +0100 Subject: [PATCH 25/28] Revert --- features/app/AppKernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 4ce2908..eef45cd 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -18,7 +18,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; +use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -64,7 +64,7 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes(RoutingConfigurator $routes): void + protected function configureRoutes(RouteCollectionBuilder $routes): void { $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); } From 54a882f4594691ef9a78763dcfd3c74632122154 Mon Sep 17 00:00:00 2001 From: Vincent Chalamon Date: Fri, 28 Jan 2022 11:29:13 +0100 Subject: [PATCH 26/28] fix: AppKernel compatibility with SF6 --- composer.json | 5 ++++- features/app/AppKernel.php | 28 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index f7210e0..b473440 100644 --- a/composer.json +++ b/composer.json @@ -82,6 +82,9 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "composer/package-versions-deprecated": true + } } } diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index eef45cd..76eb392 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -17,10 +17,12 @@ use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; /** * Test purpose micro-kernel. @@ -64,14 +66,28 @@ public function registerBundles(): array return $bundles; } - protected function configureRoutes(RouteCollectionBuilder $routes): void + /** + * @param RoutingConfigurator|RouteCollectionBuilder $routes + */ + protected function configureRoutes($routes): void { + if ($routes instanceof RoutingConfigurator) { + $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml')->prefix('/forgot_password'); + + return; + } + $routes->import('@CoopTilleulsForgotPasswordBundle/Resources/config/routing.xml', '/forgot_password'); } - protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void + /** + * @param ContainerConfigurator|ContainerBuilder $container + */ + protected function configureContainer($container, LoaderInterface $loader): void { - $c->loadFromExtension('coop_tilleuls_forgot_password', [ + $method = $container instanceof ContainerConfigurator ? 'extension' : 'loadFromExtension'; + + $container->{$method}('coop_tilleuls_forgot_password', [ 'password_token_class' => PasswordToken::class, 'user_class' => User::class, 'user' => [ @@ -80,7 +96,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'use_jms_serializer' => 'jmsserializer' === $this->getEnvironment(), ]); - $c->loadFromExtension('doctrine', [ + $container->{$method}('doctrine', [ 'dbal' => [ 'driver' => 'pdo_sqlite', 'path' => '%kernel.cache_dir%/db.sqlite', @@ -93,7 +109,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ], ]); - $c->loadFromExtension('framework', array_merge([ + $container->{$method}('framework', array_merge([ 'secret' => 'CoopTilleulsForgotPasswordBundle', 'mailer' => [ 'dsn' => 'null://null', @@ -120,7 +136,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load $firewallExtra = ['anonymous' => true]; $passwordHashers = ['encoders' => [UserInterface::class => 'plaintext']]; } - $c->loadFromExtension('security', $passwordHashers + [ + $container->{$method}('security', $passwordHashers + [ 'providers' => [ 'in_memory' => [ 'memory' => [ From aebefa0893df7fed7de6c34dd97cdca1aff2d0c8 Mon Sep 17 00:00:00 2001 From: Vincent Chalamon Date: Fri, 28 Jan 2022 11:36:05 +0100 Subject: [PATCH 27/28] fix: PHP-CS --- features/app/AppKernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 76eb392..203bfed 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -19,10 +19,9 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\RouteCollectionBuilder; -use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; -use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; /** * Test purpose micro-kernel. @@ -126,16 +125,17 @@ protected function configureContainer($container, LoaderInterface $loader): void $firewallExtra = []; $passwordHashers = [ 'password_hashers' => [ - PasswordAuthenticatedUserInterface::class => 'auto', UserInterface::class => [ 'algorithm' => 'plaintext', ], ], ]; - if (Kernel::VERSION_ID < 60000) { + + if (6 > Kernel::MAJOR_VERSION) { $firewallExtra = ['anonymous' => true]; $passwordHashers = ['encoders' => [UserInterface::class => 'plaintext']]; } + $container->{$method}('security', $passwordHashers + [ 'providers' => [ 'in_memory' => [ From 036547e2077b4a434a93c92b771b05d4dc3d49cf Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 28 Jan 2022 13:09:31 +0100 Subject: [PATCH 28/28] Symfony 6 anonymous role --- features/app/AppKernel.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/features/app/AppKernel.php b/features/app/AppKernel.php index 203bfed..c1aa3c5 100644 --- a/features/app/AppKernel.php +++ b/features/app/AppKernel.php @@ -130,10 +130,12 @@ protected function configureContainer($container, LoaderInterface $loader): void ], ], ]; + $anonymousRole = 'PUBLIC_ACCESS'; if (6 > Kernel::MAJOR_VERSION) { $firewallExtra = ['anonymous' => true]; $passwordHashers = ['encoders' => [UserInterface::class => 'plaintext']]; + $anonymousRole = 'IS_AUTHENTICATED_ANONYMOUSLY'; } $container->{$method}('security', $passwordHashers + [ @@ -154,7 +156,7 @@ protected function configureContainer($container, LoaderInterface $loader): void ] + $firewallExtra, ], 'access_control' => [ - ['path' => '^/forgot_password', 'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY'], + ['path' => '^/forgot_password', 'roles' => $anonymousRole], ['path' => '^/', 'roles' => 'IS_AUTHENTICATED_FULLY'], ], ]);