From 6a64f94184d4a3f776da3c4b705e7603ea2e4a1c Mon Sep 17 00:00:00 2001 From: Simon Paidla Date: Thu, 18 Jul 2024 16:39:12 +0200 Subject: [PATCH 1/3] TASK // Update neos compatibility --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 55c86e9..dc36f0b 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "Tooling for use in a multi-site Neos setup.", "license": "MIT", "require": { - "neos/neos": "^4.0 || ^5.0" + "neos/neos": "^4.0 || ^5.0 || ^7.0 || ^8.0" }, "autoload": { "psr-4": { From ba2d01fba1426129342ef062c4baa0a41f080fbe Mon Sep 17 00:00:00 2001 From: Simon Paidla Date: Fri, 19 Jul 2024 13:22:06 +0200 Subject: [PATCH 2/3] TASK // Refactor logger implementation for flow 7 and newer --- Classes/PersistedUsernamePasswordProvider.php | 6 +++--- composer.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/PersistedUsernamePasswordProvider.php b/Classes/PersistedUsernamePasswordProvider.php index 7a13e81..8272c33 100644 --- a/Classes/PersistedUsernamePasswordProvider.php +++ b/Classes/PersistedUsernamePasswordProvider.php @@ -13,13 +13,13 @@ use Doctrine\ORM\EntityNotFoundException; use Neos\Flow\Annotations as Flow; -use Neos\Flow\Log\SecurityLoggerInterface; use Neos\Flow\Security\Authentication\AuthenticationManagerInterface; use Neos\Flow\Security\Authentication\Provider\PersistedUsernamePasswordProvider as FlowPersistedUsernamePasswordProvider; use Neos\Flow\Security\Authentication\TokenInterface; use Neos\Flow\Security\Policy\PolicyService; use Neos\Neos\Domain\Repository\DomainRepository; use Neos\Utility\ObjectAccess; +use Psr\Log\LoggerInterface; /** * A custom site aware authentication provider extending the existing persisted username password provider @@ -45,8 +45,8 @@ class PersistedUsernamePasswordProvider extends FlowPersistedUsernamePasswordPro protected $policyService; /** - * @Flow\Inject - * @var SecurityLoggerInterface + * @Flow\Inject(name="Neos.Flow:SecurityLogger") + * @var LoggerInterface */ protected $securityLogger; diff --git a/composer.json b/composer.json index dc36f0b..bfa6523 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "Tooling for use in a multi-site Neos setup.", "license": "MIT", "require": { - "neos/neos": "^4.0 || ^5.0 || ^7.0 || ^8.0" + "neos/neos": "^7.0 || ^8.0" }, "autoload": { "psr-4": { From b6eaced70e3375520619e12778801bddee30005a Mon Sep 17 00:00:00 2001 From: Simon Paidla Date: Fri, 19 Jul 2024 13:28:39 +0200 Subject: [PATCH 3/3] TASK // Refactor logger implementation for flow 7 and newer --- Classes/Command/MultisiteCommandController.php | 6 +++++- Classes/PersistedUsernamePasswordProvider.php | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Classes/Command/MultisiteCommandController.php b/Classes/Command/MultisiteCommandController.php index 97a33ed..f457ab1 100644 --- a/Classes/Command/MultisiteCommandController.php +++ b/Classes/Command/MultisiteCommandController.php @@ -1,4 +1,5 @@ assetCollectionRepository->findOneByTitle($assetCollectionTitle); diff --git a/Classes/PersistedUsernamePasswordProvider.php b/Classes/PersistedUsernamePasswordProvider.php index 8272c33..d0b42fe 100644 --- a/Classes/PersistedUsernamePasswordProvider.php +++ b/Classes/PersistedUsernamePasswordProvider.php @@ -13,9 +13,14 @@ use Doctrine\ORM\EntityNotFoundException; use Neos\Flow\Annotations as Flow; +use Neos\Flow\Persistence\Exception\IllegalObjectTypeException; use Neos\Flow\Security\Authentication\AuthenticationManagerInterface; use Neos\Flow\Security\Authentication\Provider\PersistedUsernamePasswordProvider as FlowPersistedUsernamePasswordProvider; use Neos\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Security\Exception; +use Neos\Flow\Security\Exception\InvalidAuthenticationStatusException; +use Neos\Flow\Security\Exception\NoSuchRoleException; +use Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException; use Neos\Flow\Security\Policy\PolicyService; use Neos\Neos\Domain\Repository\DomainRepository; use Neos\Utility\ObjectAccess; @@ -56,8 +61,13 @@ class PersistedUsernamePasswordProvider extends FlowPersistedUsernamePasswordPro * * @param TokenInterface $authenticationToken The token to be authenticated * @return void + * @throws IllegalObjectTypeException + * @throws Exception + * @throws InvalidAuthenticationStatusException + * @throws NoSuchRoleException + * @throws UnsupportedAuthenticationTokenException */ - public function authenticate(TokenInterface $authenticationToken) + public function authenticate(TokenInterface $authenticationToken): void { parent::authenticate($authenticationToken); if (!$authenticationToken->getAuthenticationStatus() === TokenInterface::AUTHENTICATION_SUCCESSFUL) { @@ -90,7 +100,7 @@ public function authenticate(TokenInterface $authenticationToken) * @param TokenInterface $authenticationToken * @return void */ - protected function rollback(TokenInterface $authenticationToken) + protected function rollback(TokenInterface $authenticationToken): void { $authenticationToken->setAuthenticationStatus(TokenInterface::WRONG_CREDENTIALS); ObjectAccess::setProperty($this->authenticationManager, 'isAuthenticated', false, true);