class AuthenticationCookie extends AuthenticationPlugin (View source)

Handles the cookie authentication method

Properties

string $user Username from  AuthenticationPlugin
string $password Password from  AuthenticationPlugin
protected IpAllowDeny $ipAllowDeny from  AuthenticationPlugin
Template $template from  AuthenticationPlugin

Methods

__construct()

No description

void
showLoginForm()

Displays authentication form

bool
readCredentials()

Gets authentication credentials

bool
storeCredentials()

Set the user and password after last checkings if required

void
rememberCredentials()

Stores user credentials after successful login.

void
showFailure(string $failure)

User is not allowed to login to MySQL -> authentication failed

void
logOut()

Perform logout

string
getLoginFormURL()

Returns URL for login form.

string
getErrorMessage(string $failure)

Returns error message for failed authentication.

void
handlePasswordChange(string $password)

Callback when user changes password.

void
setSessionAccessTime()

Store session access time in session.

void
authenticate()

High level authentication interface

void
checkRules()

Check configuration defined restrictions for authentication

void
checkTwoFactor(ServerRequest $request)

Checks whether two factor authentication is active for given user and performs it.

void
storeUsernameCookie(string $username)

Stores username in a cookie.

void
storePasswordCookie(string $password)

Stores password in a cookie.

string
cookieEncrypt(string $data, string $secret)

No description

string|null
cookieDecrypt(string $encryptedData, string $secret)

No description

Details

__construct()

No description

void showLoginForm()

Displays authentication form

this function MUST exit/quit the application

Return Value

void

bool readCredentials()

Gets authentication credentials

this function DOES NOT check authentication - it just checks/provides authentication credentials required to connect to the MySQL server usually with $dbi->connect()

it returns false if something is missing - which usually leads to showLoginForm() which displays login form

it returns true if all seems ok which usually leads to auth_set_user()

it directly switches to showFailure() if user inactivity timeout is reached

Return Value

bool

bool storeCredentials()

Set the user and password after last checkings if required

Return Value

bool

void rememberCredentials()

Stores user credentials after successful login.

Return Value

void

void showFailure(string $failure)

User is not allowed to login to MySQL -> authentication failed

prepares error message and switches to showLoginForm() which display the error and the login form

Parameters

string $failure

String describing why authentication has failed

Return Value

void

void logOut()

Perform logout

Return Value

void

string getLoginFormURL()

Returns URL for login form.

Return Value

string

string getErrorMessage(string $failure)

Returns error message for failed authentication.

Parameters

string $failure

String describing why authentication has failed

Return Value

string

void handlePasswordChange(string $password)

Callback when user changes password.

Parameters

string $password

New password to set

Return Value

void

void setSessionAccessTime()

Store session access time in session.

Tries to workaround PHP 5 session garbage collection which looks at the session file's last modified time

Return Value

void

void authenticate()

High level authentication interface

Gets the credentials or shows login form if necessary

Return Value

void

void checkRules()

Check configuration defined restrictions for authentication

Return Value

void

void checkTwoFactor(ServerRequest $request)

Checks whether two factor authentication is active for given user and performs it.

Parameters

ServerRequest $request

Return Value

void

Exceptions

ExitException

void storeUsernameCookie(string $username)

Stores username in a cookie.

Parameters

string $username

User name

Return Value

void

void storePasswordCookie(string $password)

Stores password in a cookie.

Parameters

string $password Password

Return Value

void

string cookieEncrypt(string $data, string $secret)

No description

Parameters

string $data
string $secret

Return Value

string

string|null cookieDecrypt(string $encryptedData, string $secret)

No description

Parameters

string $encryptedData
string $secret

Return Value

string|null