Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 public function authenticate($userId, $challenge, $response)
 {
     Manager::logMessage("[LOGIN] Authenticating {$userId} MD5");
     $login = NULL;
     try {
         $user = Manager::getModelMAD('user');
         $user->getByLogin($userId);
         mtrace("Authenticate userID = {$userId}");
         if ($user->validatePasswordMD5($challenge, $response)) {
             $login = new MLogin($user);
             $this->setLogin($login);
             $this->setLoginLogUserId($user->getId());
             $this->setLoginLog($login->getLogin());
             Manager::logMessage("[LOGIN] Authenticated {$userId} MD5");
             return true;
         } else {
             Manager::logMessage("[LOGIN] {$userId} NOT Authenticated MD5");
         }
     } catch (Exception $e) {
         Manager::logMessage("[LOGIN] {$userId} NOT Authenticated MD5 - " . $e->getMessage());
     }
     return false;
 }
Esempio n. 3
0
 /**
  * Inicialização do Framework.
  * Método chamado para inicializar os atributos da classe Manager e registrar os AutoloadPaths.
  * @param string $configFile Arquivo de configuração do Maestro
  * @param string $basePath Diretório onde o Maestro está instalado
  * @param string $app Aplicação a ser executada.
  */
 public static function init()
 {
     $debug = self::getConf('maestro.debug.enabled');
     if ($debug) {
         $mode = self::getConf('maestro.options.mode') == 'DEV' ? Tracy\Debugger::DEVELOPMENT : Tracy\Debugger::PRODUCTION;
         Tracy\Debugger::enable($mode, self::$maestroPath . DIRECTORY_SEPARATOR . 'log');
         Tracy\Debugger::$logSeverity = self::getConf('maestro.debug.severity');
         Tracy\Debugger::$strictMode = self::getConf('maestro.debug.strictMode');
         Tracy\Debugger::$maxDepth = self::getConf('maestro.debug.maxDepth');
         // default: 3
         Tracy\Debugger::$maxLen = self::getConf('maestro.debug.maxLen');
         // default: 150
     }
     error_reporting(self::getConf('maestro.debug.severity'));
     // Maestro 1.0 compatibility
     // self::addAutoloadClass('mlogin', self::$classPath . '/Security/MLoginMaestro1.php');
     // Session
     self::$session = new MSession();
     self::$session->init($_REQUEST['sid'] === '0' ? 0 : mrequest('sid'));
     self::$baseURL = self::$request->getBaseURL(false);
     Manager::logMessage('[RESET_LOG_MESSAGES]');
     /*
             if (self::$java = ($_SERVER["SERVER_SOFTWARE"] == "JavaBridge")) {
        require_once (self::$home . "/java/Java.inc");
        self::$javaContext = java_context();
        self::$javaServletContext = java_context()->getServletContext();
             }
     * 
     */
     self::getLogin();
     self::$msg = new MMessages(self::getSession()->lang ?: self::getOptions('language'));
     self::$msg->loadMessages();
     self::$mode = self::getOptions("mode");
     date_default_timezone_set(self::getOptions("timezone"));
     setlocale(LC_ALL, self::getOptions("locale"));
     //self::$mad = self::getConf('maestro.mad.module');
     self::$app = self::getConf('maestro.app');
     register_shutdown_function("shutdown");
 }
Esempio n. 4
0
 public function checkLogin()
 {
     Manager::logMessage('[LOGIN] Running CheckLogin');
     // if not checking logins, we are done
     if (!MUtil::getBooleanValue(Manager::getConf('maestro.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');
     if ($login) {
         if ($login->getLogin()) {
             Manager::logMessage('[LOGIN] Using session login: '******'[LOGIN] Using existing login:'******'[LOGIN] No Login but Login required!');
     return false;
 }