Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
MFA management class. More...
Static Public Member Functions | |
static | cannot_login () |
Function to display to the user that they cannot login, then log them out. | |
static | check_factor_pending (string $factorname) |
Checks whether the factor was actually used in the login process. | |
static | clear_redirect_counter () |
Clears the redirect counter for infinite redirect loops. | |
static | display_debug_notification () |
Displays a debug table with current factor information. | |
static | do_factor_action (string $factorname, string $action) |
Performs factor actions for given factor. | |
static | get_cumulative_weight () |
Gets current user weight, up until first unknown factor. | |
static | get_no_redirect_urls () |
Gets all defined factor urls that should not redirect. | |
static | get_status () |
Function to get the overall status of a user's authentication. | |
static | get_total_weight () |
Returns the total weight from all factors currently enabled for user. | |
static | is_factorid_valid (int $factorid, object $user) |
Checks that provided factorid exists and belongs to current user. | |
static | is_ready () |
Checks if MFA Plugin is enabled and has enabled factor. | |
static | mfa_logout () |
Logout user. | |
static | passed_enough_factors () |
Checks whether user has passed enough factors to be allowed in. | |
static | possible_factor_setup () |
Checks if a factor that can make a user pass can be setup. | |
static | require_auth ($courseorid=null, $autologinguest=null, $cm=null, $setwantsurltome=null, $preventredirect=null) |
If MFA Plugin is ready check tool_mfa_authenticated USER property and start MFA authentication if it's not set or false. | |
static | resolve_mfa_status (bool $shouldreload=false) |
Function to check the overall status of a users authentication, and perform any required actions. | |
static | set_factor_config (array $data, string $factor) |
Sets config variable for given factor. | |
static | set_pass_state () |
Sets the session variable for pass_state, if not already set. | |
static | should_require_mfa (string|moodle_url $url, bool|null $preventredirect) |
Checks whether the user should be redirected from the provided url. | |
static | sleep_timer () |
Sleeps for an increasing period of time. | |
Public Attributes | |
int const | NO_REDIRECT = 0 |
int const | REDIR_LOOP_THRESHOLD = 5 |
int const | REDIRECT = 1 |
int const | REDIRECT_EXCEPTION = -1 |
MFA management class.
|
static |
Function to display to the user that they cannot login, then log them out.
void |
|
static |
Checks whether the factor was actually used in the login process.
string | $factorname | the name of the factor. |
bool | true if factor is pending. |
|
static |
Clears the redirect counter for infinite redirect loops.
Called from auth.php when a valid load is resolved.
void |
|
static |
Displays a debug table with current factor information.
void |
|
static |
Performs factor actions for given factor.
Change factor order and enable/disable.
string | $factorname | |
string | $action |
void |
dml_exception |
|
static |
Gets current user weight, up until first unknown factor.
int\$totalweight | Total weight of all factors. |
|
static |
Gets all defined factor urls that should not redirect.
array |
|
static |
Function to get the overall status of a user's authentication.
string | a STATE variable from plugininfo |
|
static |
Returns the total weight from all factors currently enabled for user.
int |
|
static |
Checks that provided factorid exists and belongs to current user.
int | $factorid | |
object | $user |
bool |
dml_exception |
|
static |
Checks if MFA Plugin is enabled and has enabled factor.
If plugin is disabled or there is no enabled factors, it means there is nothing to do from user side. Thus, login flow shouldn't be extended with MFA.
bool |
dml_exception |
|
static |
Logout user.
void |
|
static |
Checks whether user has passed enough factors to be allowed in.
bool | true if user has passed enough factors. |
|
static |
Checks if a factor that can make a user pass can be setup.
It checks if a user will always pass regardless, then checks if there are factors that can be setup to let a user pass.
bool |
|
static |
If MFA Plugin is ready check tool_mfa_authenticated USER property and start MFA authentication if it's not set or false.
mixed | $courseorid | |
mixed | $autologinguest | |
mixed | $cm | |
mixed | $setwantsurltome | |
mixed | $preventredirect |
void |
|
static |
Function to check the overall status of a users authentication, and perform any required actions.
bool | $shouldreload | whether the function should reload (used for auth.php). |
void |
|
static |
Sets config variable for given factor.
array | $data | |
string | $factor |
bool | true or exception |
dml_exception |
|
static |
Sets the session variable for pass_state, if not already set.
void |
|
static |
Checks whether the user should be redirected from the provided url.
string | moodle_url | $url | |
bool | null | $preventredirect |
int |
|
static |
Sleeps for an increasing period of time.
void |