redirectToLogin($GLOBALS['app']); } /** * Called when a user requests to logout * * Override default behavior. Redirect user to special "Logged Out" page in * order to prevent automatic logging in. */ public function logout() { session_destroy(); ob_clean(); header('Location: index.php?module=Users&action=LoggedOut'); sugar_cleanup(true); } /** * Redirect to login page * * @param SugarApplication $app */ public function redirectToLogin(SugarApplication $app) { require(get_custom_file_if_exists('modules/Users/authentication/SAMLAuthenticate/settings.php')); $loginVars = $app->createLoginVars(); // $settings - variable from modules/Users/authentication/SAMLAuthenticate/settings.php $settings->assertion_consumer_service_url .= htmlspecialchars($loginVars); $authRequest = new SamlAuthRequest($settings); $url = $authRequest->create(); $app->redirect($url); } }