class TwoFactor (View source)

Two factor authentication wrapper class

Properties

array $config
protected bool $writable
protected TwoFactorPlugin $backend
protected string[] $available

Methods

__construct(string $user)

Creates new TwoFactor object

array
readConfig()

Reads the configuration

bool
isWritable()

No description

getBackend()

No description

array
getAvailable()

No description

bool
showSubmit()

No description

array
getAvailableBackends()

Returns list of available backends

array
getMissingDeps()

Returns list of missing dependencies

string
getBackendClass(string $name)

Returns class name for given name

getBackendForCurrentUser()

Returns backend for current user

bool
check(ServerRequest $request, bool $skipSession = false)

Checks authentication, returns true on success

string
render(ServerRequest $request)

Renders user interface to enter two-factor authentication

string
setup(ServerRequest $request)

Renders user interface to configure two-factor authentication

Message
save()

Saves current configuration.

bool
configure(ServerRequest $request, string $name)

Changes two-factor authentication settings

array
getAllBackends()

Returns array with all available backends

Details

__construct(string $user)

Creates new TwoFactor object

Parameters

string $user

User name

array readConfig()

Reads the configuration

Return Value

array

bool isWritable()

No description

Return Value

bool

TwoFactorPlugin getBackend()

No description

Return Value

TwoFactorPlugin

array getAvailable()

No description

Return Value

array

bool showSubmit()

No description

Return Value

bool

array getAvailableBackends()

Returns list of available backends

Return Value

array

array getMissingDeps()

Returns list of missing dependencies

Return Value

array

string getBackendClass(string $name)

Returns class name for given name

Parameters

string $name

Backend name

Return Value

string

TwoFactorPlugin getBackendForCurrentUser()

Returns backend for current user

Return Value

TwoFactorPlugin

bool check(ServerRequest $request, bool $skipSession = false)

Checks authentication, returns true on success

Parameters

ServerRequest $request
bool $skipSession

Skip session cache

Return Value

bool

string render(ServerRequest $request)

Renders user interface to enter two-factor authentication

Parameters

ServerRequest $request

Return Value

string

HTML code

string setup(ServerRequest $request)

Renders user interface to configure two-factor authentication

Parameters

ServerRequest $request

Return Value

string

HTML code

Message save()

Saves current configuration.

Return Value

Message

bool configure(ServerRequest $request, string $name)

Changes two-factor authentication settings

The object might stay in partially changed setup if configuration fails.

Parameters

ServerRequest $request
string $name

Backend name

Return Value

bool

array getAllBackends()

Returns array with all available backends

Return Value

array