Beispiel #1
0
 /**
  * 
  * @param int $userId
  * @param string $challenge
  * @param string $response
  * @return boolean
  */
 public function validate($userId, $challenge, $response)
 {
     $user = Manager::getModelMAD('user');
     $user->getByLogin($userId);
     $login = $user->getLoginAtivo();
     mdump("Ldap validating userid = {$userId} - login ativo = {$login}");
     $filter = "uid={$login}";
     mdump("Ldap filter = {$filter}");
     $mldap = new \MLdap();
     $info = $mldap->search($filter, array('userPassword'));
     mdump($info);
     if ($info['count'] == 0) {
         return false;
     }
     $passLdap = trim($info[0]['userpassword'][0]);
     $hash_pass = md5(trim($login) . ':' . MLdap::ldapToMd5($passLdap) . ":" . $challenge);
     return $hash_pass == $response;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 public function validate($userId, $challenge, $response)
 {
     $user = Manager::getModelMAD('user');
     $user = $user->getByLogin($userId);
     return $user->validatePasswordMD5($challenge, $response);
 }
Beispiel #4
0
 public function getGroupsAllowed($trans, $action = A_ACCESS)
 {
     $transaction = Manager::getModelMAD('transaction');
     $transaction->getByName($trans);
     return $transaction->getGroupsAllowed($action);
 }