PHP Class FOF30\TransparentAuthentication\TransparentAuthentication

Show file Open project: akeeba/fof Class Usage Examples

Protected Properties

Property Type Description
$authenticationMethods Enabled authentication methods, see the class constants
$basicAuthUsername The username required for the Auth_HTTPBasicAuth_TOTP method
$container The container we are attached to
$logoutOnExit Should I log out the user after the dispatcher exits?
$queryParam The query parameter for the Auth_QueryString_Plaintext method
$queryParamPassword The query parameter for the password in the Auth_SplitQueryString_Plaintext method
$queryParamUsername The query parameter for the username in the Auth_SplitQueryString_Plaintext method
$timeStep The time step for TOTP authentication
$totpKey The TOTP secret key

Public Methods

Method Description
__construct ( Container $container, array $config = [] ) Public constructor.
addAuthenticationMethod ( integer $method ) Enable an authentication method
getAuthenticationMethods ( ) : array Get the enabled authentication methods
getBasicAuthUsername ( ) : string Get the required username for the HTTP Basic Authentication with TOTP method
getLogoutOnExit ( ) : boolean Should I log out when the dispatcher finishes?
getQueryParam ( ) : string Get the query parameter for the Auth_QueryString_TOTP method
getQueryParamPassword ( ) : string Get the query string for the password in the Auth_SplitQueryString_Plaintext method
getQueryParamUsername ( ) : string Get the query string for the username in the Auth_SplitQueryString_Plaintext method
getTimeStep ( ) : integer Get the time step in seconds for the TOTP in the Auth_HTTPBasicAuth_TOTP method
getTotpKey ( ) : string Get the secret key for the TOTP in the Auth_HTTPBasicAuth_TOTP method
getTransparentAuthenticationCredentials ( ) : array | null Tries to get the transparent authentication credentials from the request
removeAuthenticationMethod ( integer $method ) Disable an authentication method
setAuthenticationMethods ( array $authenticationMethods ) Set the enabled authentication methods
setBasicAuthUsername ( string $basicAuthUsername ) Set the required username for the HTTP Basic Authentication with TOTP method
setLogoutOnExit ( boolean $logoutOnExit ) Set the log out on exit flag (for testing)
setQueryParam ( string $queryParam ) Set the query parameter for the Auth_QueryString_TOTP method
setQueryParamPassword ( string $queryParamPassword ) Set the query string for the password in the Auth_SplitQueryString_Plaintext method
setQueryParamUsername ( string $queryParamUsername ) Set the query string for the username in the Auth_SplitQueryString_Plaintext method
setTimeStep ( integer $timeStep ) Set the time step in seconds for the TOTP in the Auth_HTTPBasicAuth_TOTP method
setTotpKey ( string $totpKey ) Set the secret key for the TOTP in the Auth_HTTPBasicAuth_TOTP method

Protected Methods

Method Description
parseAuthenticationMethods ( $methods ) : array Parses a list of transparent authentication methods (array or comma separated list of integers or method names) and converts it into an array of integers this class understands.

Private Methods

Method Description
decryptWithTOTP ( string $encryptedData ) : array Decrypts a transparent authentication message using a TOTP

Method Details

__construct() public method

The optional $config array can contain the following values (corresponding to the same-named properties of this class): timeStep, totpKey, cryptoKey, basicAuthUsername, queryParam, queryParamUsername, queryParamPassword, logoutOnExit. See the property descriptions for more information.
public __construct ( Container $container, array $config = [] )
$container FOF30\Container\Container
$config array

addAuthenticationMethod() public method

Enable an authentication method
public addAuthenticationMethod ( integer $method )
$method integer

getAuthenticationMethods() public method

Get the enabled authentication methods
public getAuthenticationMethods ( ) : array
return array

getBasicAuthUsername() public method

Get the required username for the HTTP Basic Authentication with TOTP method
public getBasicAuthUsername ( ) : string
return string

getLogoutOnExit() public method

Should I log out when the dispatcher finishes?
public getLogoutOnExit ( ) : boolean
return boolean

getQueryParam() public method

Get the query parameter for the Auth_QueryString_TOTP method
public getQueryParam ( ) : string
return string

getQueryParamPassword() public method

Get the query string for the password in the Auth_SplitQueryString_Plaintext method
public getQueryParamPassword ( ) : string
return string

getQueryParamUsername() public method

Get the query string for the username in the Auth_SplitQueryString_Plaintext method
public getQueryParamUsername ( ) : string
return string

getTimeStep() public method

Get the time step in seconds for the TOTP in the Auth_HTTPBasicAuth_TOTP method
public getTimeStep ( ) : integer
return integer

getTotpKey() public method

Get the secret key for the TOTP in the Auth_HTTPBasicAuth_TOTP method
public getTotpKey ( ) : string
return string

getTransparentAuthenticationCredentials() public method

Tries to get the transparent authentication credentials from the request

parseAuthenticationMethods() protected method

Parses a list of transparent authentication methods (array or comma separated list of integers or method names) and converts it into an array of integers this class understands.
protected parseAuthenticationMethods ( $methods ) : array
$methods
return array

removeAuthenticationMethod() public method

Disable an authentication method
public removeAuthenticationMethod ( integer $method )
$method integer

setAuthenticationMethods() public method

Set the enabled authentication methods
public setAuthenticationMethods ( array $authenticationMethods )
$authenticationMethods array

setBasicAuthUsername() public method

Set the required username for the HTTP Basic Authentication with TOTP method
public setBasicAuthUsername ( string $basicAuthUsername )
$basicAuthUsername string

setLogoutOnExit() public method

Set the log out on exit flag (for testing)
public setLogoutOnExit ( boolean $logoutOnExit )
$logoutOnExit boolean

setQueryParam() public method

Set the query parameter for the Auth_QueryString_TOTP method
public setQueryParam ( string $queryParam )
$queryParam string

setQueryParamPassword() public method

Set the query string for the password in the Auth_SplitQueryString_Plaintext method
public setQueryParamPassword ( string $queryParamPassword )
$queryParamPassword string

setQueryParamUsername() public method

Set the query string for the username in the Auth_SplitQueryString_Plaintext method
public setQueryParamUsername ( string $queryParamUsername )
$queryParamUsername string

setTimeStep() public method

Set the time step in seconds for the TOTP in the Auth_HTTPBasicAuth_TOTP method
public setTimeStep ( integer $timeStep )
$timeStep integer

setTotpKey() public method

Set the secret key for the TOTP in the Auth_HTTPBasicAuth_TOTP method
public setTotpKey ( string $totpKey )
$totpKey string

Property Details

$authenticationMethods protected property

Enabled authentication methods, see the class constants
protected $authenticationMethods

$basicAuthUsername protected property

The username required for the Auth_HTTPBasicAuth_TOTP method
protected $basicAuthUsername

$container protected property

The container we are attached to
protected $container

$logoutOnExit protected property

Should I log out the user after the dispatcher exits?
protected $logoutOnExit

$queryParam protected property

The query parameter for the Auth_QueryString_Plaintext method
protected $queryParam

$queryParamPassword protected property

The query parameter for the password in the Auth_SplitQueryString_Plaintext method
protected $queryParamPassword

$queryParamUsername protected property

The query parameter for the username in the Auth_SplitQueryString_Plaintext method
protected $queryParamUsername

$timeStep protected property

The time step for TOTP authentication
protected $timeStep

$totpKey protected property

The TOTP secret key
protected $totpKey