PasswordCredentialVerifier
final readonly class \
The parts of a password login that the native backend and frontend authenticators share: the request token check, the password verification against a stored hash, the creation of a replacement hash and the timing mitigation for unknown users. The hash method and the request token scope are derived from the login type of the user object.
Nothing is persisted here: where a user record and its hash are stored is the business of the identity provider the authenticator looked the user up with.
Internal
not part of TYPO3 Core API yet, still experimental as part of the authentication pipeline groundwork
Table of Contents
Methods
- __construct() : mixed
- hashPassword() : string
- Hashes the password with the default hash method of the login type of the user.
- mimicPasswordHashing() : void
- Mimics password hashing for a login of an unknown user to mitigate
- requestTokenMatches() : bool
- Validates the submitted request token (nonce) for the authentication scope of the user ("core/user-auth/be" or "core/user-auth/fe") and revokes its signing secret. Listeners of BeforeRequestTokenProcessedEvent may adjust the token, felogin also derives the storage page restriction from it.
- verify() : PasswordVerification
- Verifies the password against the stored hash. A matching password whose hash is outdated or not created with the default hash method of the login type is reported as such, so the caller can store a replacement created by hashPassword().
Methods
__construct()
public
__construct(PasswordHashFactory $passwordHashFactory, Context $context, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $passwordHashFactory : PasswordHashFactory
- $context : Context
- $eventDispatcher : EventDispatcherInterface
hashPassword()
Hashes the password with the default hash method of the login type of the user.
public
hashPassword(AbstractUserAuthentication $user, string $password) : string
Parameters
- $user : AbstractUserAuthentication
- $password : string
Return values
stringmimicPasswordHashing()
Mimics password hashing for a login of an unknown user to mitigate
public
mimicPasswordHashing(AbstractUserAuthentication $user) : void
Parameters
- $user : AbstractUserAuthentication
Tags
requestTokenMatches()
Validates the submitted request token (nonce) for the authentication scope of the user ("core/user-auth/be" or "core/user-auth/fe") and revokes its signing secret. Listeners of BeforeRequestTokenProcessedEvent may adjust the token, felogin also derives the storage page restriction from it.
public
requestTokenMatches(AbstractUserAuthentication $user, ServerRequestInterface $request) : bool
Parameters
- $user : AbstractUserAuthentication
- $request : ServerRequestInterface
Return values
boolverify()
Verifies the password against the stored hash. A matching password whose hash is outdated or not created with the default hash method of the login type is reported as such, so the caller can store a replacement created by hashPassword().
public
verify(AbstractUserAuthentication $user, string $passwordHash, string $password) : PasswordVerification
Parameters
- $user : AbstractUserAuthentication
- $passwordHash : string
- $password : string