class AccountFactory (View source)

A factory for conveniently creating new accounts

Properties

protected HashService $hashService
protected PolicyService $policyService

Methods

createAccountWithPassword(string $identifier, string $password, array $roleIdentifiers = [], string $authenticationProviderName = 'DefaultProvider', string $passwordHashingStrategy = 'default')

Creates a new account and sets the given password and roles

Details

Account createAccountWithPassword(string $identifier, string $password, array $roleIdentifiers = [], string $authenticationProviderName = 'DefaultProvider', string $passwordHashingStrategy = 'default')

Creates a new account and sets the given password and roles

Parameters

string $identifier

Identifier of the account, must be unique

string $password

The clear text password

array $roleIdentifiers

Optionally an array of role identifiers to assign to the new account

string $authenticationProviderName

Optional name of the authentication provider the account is affiliated with

string $passwordHashingStrategy

Optional password hashing strategy to use for the password

Return Value

Account

A new account, not yet added to the account repository