Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK // Neos 7+ compatibility #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Classes/Command/MultisiteCommandController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Flownative\Neos\MultisiteHelper\Command;

/*
Expand All @@ -13,6 +14,8 @@

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\ObjectManagement\Exception\UnresolvedDependenciesException;
use Neos\Flow\Persistence\Exception\IllegalObjectTypeException;
use Neos\Media\Domain\Model\AssetCollection;
use Neos\Media\Domain\Repository\AssetCollectionRepository;
use Neos\Neos\Domain\Model\Site;
Expand Down Expand Up @@ -42,8 +45,9 @@ class MultisiteCommandController extends CommandController
*
* @param string $siteNodeName
* @return void
* @throws IllegalObjectTypeException|UnresolvedDependenciesException
*/
public function setupCommand($siteNodeName)
public function setupCommand($siteNodeName): void
{
$assetCollectionTitle = ucfirst($siteNodeName);
$assetCollection = $this->assetCollectionRepository->findOneByTitle($assetCollectionTitle);
Expand Down
20 changes: 15 additions & 5 deletions Classes/PersistedUsernamePasswordProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@

use Doctrine\ORM\EntityNotFoundException;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Log\SecurityLoggerInterface;
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;
use Psr\Log\LoggerInterface;

/**
* A custom site aware authentication provider extending the existing persisted username password provider
Expand All @@ -45,8 +50,8 @@ class PersistedUsernamePasswordProvider extends FlowPersistedUsernamePasswordPro
protected $policyService;

/**
* @Flow\Inject
* @var SecurityLoggerInterface
* @Flow\Inject(name="Neos.Flow:SecurityLogger")
* @var LoggerInterface
*/
protected $securityLogger;

Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
Expand Down