class VerifyHandler implements VerifyHandlerInterface (View source)

Handles verification requests using a time-based one-time password (TOTP) with the silverstripe/mfa module.

Traits

A class that can be instantiated or replaced via DI

Properties

protected LoggerInterface $logger

Methods

public static 
create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

public static 
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

protected
string
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.

protected
TOTPInterface
getTotp(StoreInterface $store)

Get an instance of the TOTP handler service. The secret must already be defined and set to the StoreInterface.

public
array
start(StoreInterface $store, RegisteredMethod $method)

Stores any data required to handle a login process with a method, and returns relevant state to be applied to the front-end application managing the process.

public
verify(HTTPRequest $request, StoreInterface $store, RegisteredMethod $registeredMethod)

Verify the request has provided the right information to verify the member that aligns with any sessions state that may have been set prior

public
string
getComponent()

Get the key that a React UI component is registered under (with @silverstripe/react-injector on the front-end)

public
LoggerInterface|null
getLogger()

No description

public
setLogger(LoggerInterface $logger)

No description

Details

static Injectable create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();

Parameters

mixed ...$args

Return Value

Injectable

static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class

Optional classname to create, if the called class should not be used

Return Value

Injectable

The singleton instance

protected string 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.

Return Value

string

protected TOTPInterface getTotp(StoreInterface $store)

Get an instance of the TOTP handler service. The secret must already be defined and set to the StoreInterface.

Parameters

StoreInterface $store

Return Value

TOTPInterface

Exceptions

RuntimeException

array start(StoreInterface $store, RegisteredMethod $method)

Stores any data required to handle a login process with a method, and returns relevant state to be applied to the front-end application managing the process.

Parameters

StoreInterface $store

An object that hold session data (and the Member) that can be mutated

RegisteredMethod $method

The RegisteredMethod instance that is being verified

Return Value

array

Props to be passed to a front-end component

Result verify(HTTPRequest $request, StoreInterface $store, RegisteredMethod $registeredMethod)

Verify the request has provided the right information to verify the member that aligns with any sessions state that may have been set prior

Parameters

HTTPRequest $request
StoreInterface $store
RegisteredMethod $registeredMethod

The RegisteredMethod instance that is being verified

Return Value

Result

string getComponent()

Get the key that a React UI component is registered under (with @silverstripe/react-injector on the front-end)

Return Value

string

LoggerInterface|null getLogger()

No description

Return Value

LoggerInterface|null

VerifyHandler setLogger(LoggerInterface $logger)

No description

Parameters

LoggerInterface $logger

Return Value

VerifyHandler