TwoFactorAuthReadService
in package
Class representing a two-factor-authorization read service
Table of Contents
- $configurationStorage : AuthConfigurationStorage
- Configuration storage
- $safetyFileStorage : AuthSafetyFileStorage
- Safety file storage
- $toleratedDelay : IntType
- Tolerated time window drift
- __construct() : mixed
- Create instance
- randomSecret() : AuthSecret
- Return a random secret
- safetyFileExistenceForCustomer() : bool
- Return whether a safety file exists for the provided customer ID
- tokenForCustomer() : AuthToken
- Return the token for the provided customer ID
- tokenForSecret() : AuthToken
- Return the token for the provided secret
- tokenValidityForCustomer() : bool
- Return whether the provided token is valid for the provided customer ID
- tokenValidityForSecret() : bool
- Return whether the provided token is valid for the provided secret
- usageStatusForCustomer() : bool
- Return whether the provided customer has a secret and a safety file This method should be used to check whether the provided customer is using 2FA
Properties
$configurationStorage
Configuration storage
protected
AuthConfigurationStorage
$configurationStorage
$safetyFileStorage
Safety file storage
protected
AuthSafetyFileStorage
$safetyFileStorage
$toleratedDelay
Tolerated time window drift
protected
IntType
$toleratedDelay
Methods
__construct()
Create instance
public
__construct(AuthConfigurationStorage $configurationStorage, AuthSafetyFileStorage $safetyFileStorage, IntType $toleratedDelay) : mixed
Parameters
- $configurationStorage : AuthConfigurationStorage
-
Configuration storage
- $safetyFileStorage : AuthSafetyFileStorage
-
Safety file storage
- $toleratedDelay : IntType
-
Tolerated time window drift
Return values
mixed —randomSecret()
Return a random secret
public
randomSecret() : AuthSecret
Return values
AuthSecret —Randomly created secret
safetyFileExistenceForCustomer()
Return whether a safety file exists for the provided customer ID
public
safetyFileExistenceForCustomer(IdType $customerId) : bool
Parameters
- $customerId : IdType
-
Customer ID
Return values
bool —Whether a safety file exists for the provided customer ID
tokenForCustomer()
Return the token for the provided customer ID
public
tokenForCustomer(IdType $customerId[, IntType|null $timestamp = null ]) : AuthToken
Parameters
Return values
AuthToken —Token for the provided customer ID
tokenForSecret()
Return the token for the provided secret
public
tokenForSecret(AuthSecret $secret[, IntType|null $timestamp = null ]) : AuthToken
Parameters
- $secret : AuthSecret
-
Secret
- $timestamp : IntType|null = null
-
Timestamp
Return values
AuthToken —Token for the provided secret
tokenValidityForCustomer()
Return whether the provided token is valid for the provided customer ID
public
tokenValidityForCustomer(AuthToken $token, IdType $customerId) : bool
Parameters
Return values
bool —Whether the provided token is valid for the provided customer
tokenValidityForSecret()
Return whether the provided token is valid for the provided secret
public
tokenValidityForSecret(AuthToken $token, AuthSecret $secret) : bool
Parameters
- $token : AuthToken
-
Token
- $secret : AuthSecret
-
Secret
Return values
bool —Whether the provided is valid for the provided secret
usageStatusForCustomer()
Return whether the provided customer has a secret and a safety file This method should be used to check whether the provided customer is using 2FA
public
usageStatusForCustomer(IdType $customerId) : bool
Parameters
- $customerId : IdType
-
Customer ID
Return values
bool —Whether the provided customer uses 2FA