class TwoFactor (View source)

Two factor authentication wrapper class

Properties

string $user
array $config
protected bool $writable
protected TwoFactorPlugin $backend
protected array $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(bool $skipSession = false)

Checks authentication, returns true on success

string
render()

Renders user interface to enter two-factor authentication

string
setup()

Renders user interface to configure two-factor authentication

true|Message
save()

Saves current configuration.

bool
configure(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(bool $skipSession = false)

Checks authentication, returns true on success

Parameters

bool $skipSession

Skip session cache

Return Value

bool

string render()

Renders user interface to enter two-factor authentication

Return Value

string

HTML code

string setup()

Renders user interface to configure two-factor authentication

Return Value

string

HTML code

true|Message save()

Saves current configuration.

Return Value

true|Message

bool configure(string $name)

Changes two-factor authentication settings

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

Parameters

string $name

Backend name

Return Value

bool

array getAllBackends()

Returns array with all available backends

Return Value

array