/** * Called on application initialisation. * * @return void * * @since 2.0 */ public function onAfterInitialise() { $input = new JInput(); $config = SHFactory::getConfig(); $bypass = $config->get('sso.bypasskey', 'nosso'); // Check if the URL contains this key and the value assigned to it $value = $input->get($bypass, false); // Check whether the url has been set if ($value !== false) { $value = (int) $value; if ($value === SHSsoHelper::STATUS_ENABLE) { // Enable SSO SHSsoHelper::enable(true); } elseif ($value === SHSsoHelper::STATUS_LOGOUT_DISABLE) { // SSO user logout detected SHSsoHelper::disable(false); } elseif ($value === SHSsoHelper::STATUS_BYPASS_DISABLE) { // Disable SSO for bypass SHSsoHelper::disable(true); } } $this->_attemptSSO(); }
/** * Calls the logoutRemoteUser method within SSO plug-in if the user * was logged on with SSO. * * @return void * * @since 2.0 */ public function logout() { $session = JFactory::getSession(); $app = JFactory::getApplication(); // Get the SSO plug-in name from login if we used SSO if ($class = $session->get(SHSsoHelper::SESSION_PLUGIN_KEY, false)) { // Lets disable SSO until the user requests login SHSsoHelper::disable(); $router = $app->getRouter(); // We need to add a callback on the router to tell the routed page we just logged out from SSO $router->setVar('ssologoutkey', SHFactory::getConfig()->get('sso.bypasskey', 'nosso')); $router->setVar('ssologoutval', $session->get(SHSsoHelper::SESSION_STATUS_KEY, SHSsoHelper::STATUS_ENABLE)); $router->attachBuildRule('SHSso::logoutRouterRule'); $index = array_search($class, $this->_observers); // Ensure the SSO plug-in is still available if ($index !== false && method_exists($this->_observers[$index], 'logoutRemoteUser')) { $this->_observers[$index]->logoutRemoteUser(); } } }