-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
332 additions
and
26 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
eZ/Bundle/PlatformInstallerBundle/src/Command/ValidatePasswordHashesCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\PlatformInstallerBundle\Command; | ||
|
||
use eZ\Publish\Core\FieldType\User\UserStorage; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class ValidatePasswordHashesCommand extends Command | ||
{ | ||
/** @var \eZ\Publish\Core\FieldType\User\UserStorage */ | ||
private $userStorage; | ||
|
||
public function __construct( | ||
UserStorage $userStorage | ||
) { | ||
$this->userStorage = $userStorage; | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure() | ||
{ | ||
$this->setName('ezplatform:user:validate-password-hashes'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$unsupportedHashesCounter = $this->userStorage->countUsersWithUnsupportedHashType(); | ||
|
||
if ($unsupportedHashesCounter > 0) { | ||
$output->writeln(sprintf('<error>Found %s users with unsupported password hash types</error>', $unsupportedHashesCounter)); | ||
$output->writeln('<info>For more details check documentation:</info> <href=https://doc.ezplatform.com/en/latest/releases/ez_platform_v3.0_deprecations/#password-hashes>https://doc.ezplatform.com/en/latest/releases/ez_platform_v3.0_deprecations/#password-hashes</>'); | ||
} else { | ||
$output->writeln('OK - <info>All users have supported password hash types</info>'); | ||
} | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
eZ/Publish/API/Repository/Exceptions/PasswordInUnsupportedFormatException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\API\Repository\Exceptions; | ||
|
||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
use Throwable; | ||
|
||
class PasswordInUnsupportedFormatException extends AuthenticationException | ||
{ | ||
public function __construct(Throwable $previous = null) | ||
{ | ||
parent::__construct("User's password is in a format which is not supported any more.", 0, $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...lish/Core/FieldType/Tests/Integration/User/UserStorage/UserDoctrineStorageGatewayTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Integration\User\UserStorage; | ||
|
||
use eZ\Publish\Core\FieldType\Tests\Integration\User\UserStorage\UserStorageGatewayTest; | ||
use eZ\Publish\Core\FieldType\User\UserStorage\Gateway as UserStorageGateway; | ||
use eZ\Publish\Core\FieldType\User\UserStorage\Gateway\DoctrineStorage; | ||
|
||
final class UserDoctrineStorageGatewayTest extends UserStorageGatewayTest | ||
{ | ||
protected function getGateway(): UserStorageGateway | ||
{ | ||
return new DoctrineStorage($this->getDatabaseConnection()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
eZ/Publish/Core/FieldType/Tests/Integration/User/UserStorage/_fixtures/unsupported_hash.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ezuser: | ||
- { contentobject_id: 10, email: nospam@ez.no, login: anonymous, password_hash: $2y$10$35gOSQs6JK4u4whyERaeUuVeQBi2TUBIZIfP7HEj7sfz.MxvTuOeC, password_hash_type: 7 } | ||
- { contentobject_id: 16, email: test@link.invalid, login: test, password_hash: $2y$10$35gOSQs6JK4u4whyERaeUuVeQBi2TUBIZIfP7HEj7sfz.MxvTuOeC, password_hash_type: 5 } | ||
- { contentobject_id: 14, email: spam@ez.no, login: admin, password_hash: $2y$10$FDn9NPwzhq85cLLxfD5Wu.L3SL3Z/LNCvhkltJUV0wcJj7ciJg2oy, password_hash_type: 7 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.