示例#1
0
 function &getContainer()
 {
     static $container;
     if (!isset($container)) {
         include 'auth_container_mdb2_options.php';
         $container = new Auth_Container_MDB2($options);
         // Catch if DB connection cannot be made
         $res = $container->_prepare();
     }
     if (!MDB2::isConnection($container->db)) {
         $this->markTestSkipped("MDB2 is not a connection object, check dsn");
     }
     return $container;
 }
 function &getContainer()
 {
     static $container;
     #print "In MDB2Container::getContainer {$this->skip_tests}\n";
     if (!isset($container)) {
         include './auth_container_mdb2_options.php';
         $container = new Auth_Container_MDB2($options);
         // Catch if DB connection cannot be made
         $res = $container->_prepare();
     }
     if (!MDB2::isConnection($container->db)) {
         #print "In MDB2Container::getContainer container->db is error \n";
         $this->skip_tests = true;
         $this->skip_tests_message = "SKIP TEST:MDB2 is not a connection object, check dsn !!!";
     }
     return $container;
 }
 function fetchData($username, $password, $isChallengeResponse = false)
 {
     $username = ilAuthContainerDatabase::toUsernameWithoutDomain($username);
     $isSuccessful = parent::fetchData($username, $password, $isChallengeResponse);
     if ($this->isObserversEnabled) {
         if ($isSuccessful) {
             $this->loginObserver($username);
         } else {
             $this->failedLoginObserver();
         }
     }
     return $isSuccessful;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     global $ilClientIniFile, $ilDB, $ilIliasIniFile;
     $options['dsn'] = $ilDB->getDSN();
     $options['table'] = $ilClientIniFile->readVariable('auth', 'table');
     $options['usernamecol'] = $ilClientIniFile->readVariable('auth', 'usercol');
     $options['passwordcol'] = $ilClientIniFile->readVariable('auth', 'passcol');
     // studip mode: check against submitted md5 password for ilSoapUserAdministration::login()
     // todo: check whether we should put this to another place
     if (isset($_POST['password']) && preg_match('/^[a-f0-9]{32,32}$/i', $_POST['password'])) {
         if ($ilIliasIniFile->readVariable('server', 'studip')) {
             $options['cryptType'] = 'none';
         }
     }
     parent::__construct($options);
 }
示例#5
0
 function __construct($dsn)
 {
     parent::__construct($dsn);
 }
 /**
  * @param    string $raw
  * @param    string $encoded
  * @param           string    string    $cryptType
  * @return    bool
  */
 public function verifyPassword($raw, $encoded, $crypt_type = 'md5')
 {
     $this->log(__METHOD__ . ' called.', AUTH_LOG_DEBUG);
     if (in_array($crypt_type, array('none', ''))) {
         return parent::verifyPassword($raw, $encoded, $crypt_type);
     }
     require_once 'Services/User/classes/class.ilUserPasswordManager.php';
     $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
     if (ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type)) {
         /**
          * @var $user ilObjUser
          */
         $user = ilObjectFactory::getInstanceByObjId(ilObjUser::_loginExists($this->_auth_obj->username));
         $user->setPasswd($encoded, IL_PASSWD_CRYPTED);
         return ilUserPasswordManager::getInstance()->verifyPassword($user, $raw);
     }
     // Fall through: Let pear verify the password
     return parent::verifyPassword($raw, $encoded, $crypt_type);
 }