SilverStripe\TOTP\RegisterHandler
Handles registration requests using a time-based one-time password (TOTP) with the silverstripe/mfa module.
Synopsis
class RegisterHandler
implements
RegisterHandlerInterface
{
- // members
- private static string $user_help_link = 'https://userhelp.silverstripe.org/en/4/optional_features/multi-factor_authentication/user_manual/using_authenticator_apps/';
- private static integer $secret_length = 16;
- // methods
- public void start()
- protected string generateSecret()
- public Result register()
- public void getDescription()
- public void getSupportLink()
- public void getSupportText()
- public void getComponent()
- // Inherited methods from TOTPAware
- protected string getEncryptionKey()
- protected TOTPInterface getTotp()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
- SilverStripe\Core\Extensible
- SilverStripe\TOTP\TOTPAware
Implements
- SilverStripe\MFA\Method\Handler\RegisterHandlerInterface
Members
private
- $secret_length
—
int
The desired length of the TOTP secret. This affects the UI, since it is displayed to the user to be entered manually if they cannot scan the QR code. - $user_help_link
—
string
The link to SilverStripe user help documentation for this authenticator.
Methods
protected
- generateSecret() — Generates a TOTP secret to the configured maximum length
public
- getComponent()
- getDescription()
- getSupportLink()
- getSupportText()
- register() — Validate the provided TOTP code and return the TOTP secret to be stored against the RegisteredMethod model.
- start()
Inherited from SilverStripe\TOTP\TOTPAware
protected
- getEncryptionKey() — Gets the encryption key to use from environment variables. This is generated by default on the Common Web Platform, but can be defined as a custom value if required.
- getTotp() — Get an instance of the TOTP handler service. The secret must already be defined and set to the StoreInterface.