/** * Verifica se a senha fornecida por um usuário é válida * utilizando autenticação challenge-response. * * @param int $userId * @param string $challenge * @param string $response * @return boolean */ public function authenticate($userId, $challenge, $response) { Manager::logMessage("[LOGIN] Authenticating {$userId} LdapMD5"); $login = NULL; try { if ($this->validate($userId, $challenge, $response)) { $user = Manager::getModelMAD('user'); $user->getByLogin($userId); $profile = $user->getProfileAtual(); $user->getByProfile($profile); $login = new MLogin($user); if (Manager::getOptions("dbsession")) { $session = Manager::getModelMAD('session'); $session->lastAccess($login); $session->registerIn($login); } $this->setLogin($login); $this->setLoginLogUserId($user->getId()); $this->setLoginLog($login->getLogin()); Manager::logMessage("[LOGIN] Authenticated {$userId} LdapMD5"); return true; } } catch (Exception $e) { Manager::logMessage("[LOGIN] {$userId} NOT Authenticated LdapMD5 - " . $e->getMessage()); } Manager::logMessage("[LOGIN] {$userId} NOT Authenticated LdapMD5"); return false; }
public function checkLogin() { Manager::logMessage('[LOGIN] Running CheckLogin'); // if not checking logins, we are done if (!MUtil::getBooleanValue(Manager::$conf['login']['check'])) { Manager::logMessage('[LOGIN] I am not checking login today...'); return true; } // we have a session login? $session = Manager::getSession(); $login = $session->getValue('__sessionLogin'); $loginMiolo = $_SESSION['login']; // Miolo compatibility if ($loginMiolo) { if (is_null($login)) { // se ainda não tem login no Maestro... $user = Manager::getModelMAD('user'); $user->getByLogin($loginMiolo->id); $profile = $user->getProfileAtual(); $user->getByProfile($profile); $login = new MLogin($user); $this->setLogin($login); Manager::logMessage("[LOGIN] Authenticated {$loginMiolo->idkey} from Miolo"); } } if ($login) { if ($login->getLogin()) { Manager::logMessage('[LOGIN] Using session login: '******'[LOGIN] Using existing login:'******'[LOGIN] No Login but Login required!'); return false; }
public function invokeService($app, $module, $controllerAction) { Manager::logMessage("[FrontController::invokeService {$app}:{$module}:{$controllerAction}]"); list($class, $action) = explode('.', $controllerAction); $this->controller = $controller = Manager::getService($app, $module, $class); $controller->setParams($this->getData()); $controller->setData(); $controller->init(); $controller->dispatch($action); }