Class handling the two factor authentication
- Author
- Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
- Since
- Stud.IP 4.4
- See also
- TFASecret model
◆ confirm()
confirm |
( |
string |
$action, |
|
|
string |
$text, |
|
|
array |
$data = [] |
|
) |
| |
Requests a 2fa token input to confirm a specific action.
- Parameters
-
string | $action | Name of the action to confirm |
string | $text | Text to display to the user |
array | $data | Optional additional data to pass to the confirmation screen (for internal use) |
◆ get()
Returns an instance of the authentication
- Returns
- TwoFactorAuth object
◆ isEnabledForUser()
static isEnabledForUser |
( |
User |
$user = null | ) |
|
|
static |
Returns whether the two factor authentication is enabled for the given user (defaults to current user). The user's permissions decide whether the two factor authentication is enabled or not.
- Parameters
-
User | null | $user | User to check (optional, defaults to current user) |
- Returns
- boolean
◆ removeCookie()
◆ secureSession()
Secures the current session, if applicable.
This method checks the following:
- is 2fa enabled for the current user
- is the request an ajax call
- does the user have a secret, meaning 2fa is enabled
- is the secret already confirmed
- has the session already been confirmed (identified by a valid random token stored in the session)
- is the computer trusted (identified by a valid random token stored in a cookie)
If the user has 2fa enabled, it's secret is confirmed and the session has not been secured yet, a validation screen with a prompt to enter a valid token is presented to the user.
◆ COOKIE_KEY
const COOKIE_KEY = 'tfa/authentication' |
◆ SESSION_CONFIRMATIONS
const SESSION_CONFIRMATIONS = 'tfa/confirmations' |
◆ SESSION_DATA
const SESSION_DATA = 'tfa/data' |
◆ SESSION_FAILED
const SESSION_FAILED = 'tfa/failed' |
◆ SESSION_KEY
const SESSION_KEY = 'tfa/confirmed' |
◆ SESSION_TOKEN_SENT
const SESSION_TOKEN_SENT = 'tfa/token-sent' |
The documentation for this class was generated from the following file: