/** * _default * * @param mixed $request Request to use * * @access public * @return void */ public function _default($request) { $subject = \Native5\Identity\SecurityUtils::getSubject(); if ($subject->isAuthenticated()) { $this->_response->redirectTo('dashboard'); $this->_response->send(); } $this->_response = new \Native5\Route\HttpResponse('none', new \Native5\UI\TwigRenderer('login.tmpl')); $this->_response->addHeader('Cache-Control: no-cache, must-revalidate'); $this->_response->setBody(array()); }
/** * Default Handler for Logout Controller * * @param mixed $request Request to process. * * @access public * @return void */ public function _default($request) { $subject = \Native5\Identity\SecurityUtils::getSubject(); $subject->logout(); \Native5\Sessions\WebSessionManager::resetActiveSession(); $this->_response = new \Native5\Route\HttpResponse(); $this->_response->redirectTo('./login'); //$idenService = new \Native5\Services\Identity\RemoteAuthenticationService(); //$idenService->onLogout(); //WebSessionManager::resetActiveSession(); //$this->_response = new \Native5\Route\HttpResponse(); //$this->_response->redirectTo('./'); }
/** * _default * * @param mixed $request The incoming request * * @access public * @return void */ public function _default($request) { global $logger; global $app; $subject = SecurityUtils::getSubject(); $logger->debug('Authentication Status ' . print_r($subject, 1)); if ($subject->isAuthenticated() === true) { $this->_response->redirectTo('dashboard'); } else { $token = new UsernamePasswordToken($request->getParam('username'), $request->getParam('password')); try { $subject->login($token); $this->_response->redirectTo('dashboard'); } catch (AuthenticationException $aex) { $this->_handleFailedAuthentication($subject, $token, $aex); } } }
private function __setUser() { // Create the (helper) user object from the authenticated subject if present $subject = \Native5\Identity\SecurityUtils::getSubject(); if ($subject->isAuthenticated()) { $this->user = \Akzo\User\Service::getInstance()->getUser($subject->getPrincipal()['username'], $subject); } }
/** * updateActiveSession * * @access public * @return void */ public static function updateActiveSession() { $_SESSION[self::GLOBAL_PREFIX.'last_accessed'] = time(); // Update the session if session is authenticated and multiple logins is disabled $app = $GLOBALS['app']; if(\Native5\Identity\SecurityUtils::getSubject()->isAuthenticated() && $app->getConfiguration()->isPreventMultipleLogins()) { $sessionHash = $app->getSessionManager()->getActiveSession()->getAttribute('sessionHash'); $authenticator = new \Native5\Services\Identity\RemoteAuthenticationService(); $authenticator->onAccess($sessionHash); } }//end updateActiveSession()