/** * hma_login_in_user_from_sso_providers function. * * @access public * @return null | bool */ function hma_login_in_user_from_sso_providers() { if (is_user_logged_in()) { return null; } foreach (hma_get_sso_providers() as $sso_provider) { if ($sso_provider->check_for_provider_logged_in()) { if ($sso_provider->login()) { return true; } } } }
/** * Returns an array of all the SSO providers a user has not authenticated with. * * @return array */ function hma_get_sso_providers_not_authenticated_for_current_user() { $authenticated_providers = hma_get_sso_providers_for_current_user(); $unauthenticated_providers = array(); foreach (hma_get_sso_providers() as $p) { if (!in_array($p, $authenticated_providers)) { $unauthenticated_providers[] = $p; } } return $unauthenticated_providers; }