-
Notifications
You must be signed in to change notification settings - Fork 30
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
EZP-32250: Exposed PasswordHashService APIs #150
Conversation
…ED_PASSWORD_HASHES clarification
eZ/Publish/Core/Repository/User/PasswordHashServiceInterface.php
Outdated
Show resolved
Hide resolved
interface PasswordHashServiceInterface | ||
{ | ||
public function getDefaultHashType(): int; | ||
|
||
public function getSupportedHashTypes(): array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since other methods specifically ask for int
.
public function getSupportedHashTypes(): array; | |
/** | |
* @return int[] | |
*/ | |
public function getSupportedHashTypes(): array; |
@@ -24,6 +24,9 @@ | |||
*/ | |||
abstract class User extends Content implements UserReference | |||
{ | |||
/** | |||
* @var int[] List of supported (by default) hash types. | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: to speed up checks if hash is supported this can be turned into array<int, int>
. Then to check support for hash you'd just see if:
isset(User::SUPPORTED_PASSWORD_HASHES[$hashType]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Premature optimization is the root of all evil
D. Knuth
v3.3
Added methods
getSupportedHashTypes(): array
isHashTypeSupported(int $hashType): bool
to
\eZ\Publish\Core\Repository\User\PasswordHashServiceInterface
and refactor existing\eZ\Publish\API\Repository\Values\User\User::SUPPORTED_PASSWORD_HASHES
usagesThis allows to decorate
PasswordHashService
in 3rd-party bundles and add support for custom password hash types.Checklist:
$ composer fix-cs
).@ezsystems/php-dev-team
).