예제 #1
0
 public function testSetAndGetUsername()
 {
     $usernameExpected = 'someUsername';
     $usernameActual = $this->_adapter->setUsername($usernameExpected)
                                      ->getUsername();
     $this->assertSame($usernameExpected, $usernameActual);
 }
 public function testCanonAuth()
 {
     /* This test authenticates with each of the account name forms
      * (uname, uname@example.com, EXAMPLE\uname) AND it does so with
      * the accountCanonicalForm set to each of the account name forms
      * (e.g. authenticate with uname@example.com but getIdentity() returns
      * EXAMPLE\uname). A total of 9 authentications are performed.
      */
     foreach ($this->_names as $form => $formName) {
         $options = $this->_options;
         $options['accountCanonicalForm'] = $form;
         $adapter = new Zend_Auth_Adapter_Ldap(array($options));
         $adapter->setPassword(TESTS_ZEND_LDAP_ALT_PASSWORD);
         foreach ($this->_names as $username) {
             $adapter->setUsername($username);
             $result = $adapter->authenticate();
             $this->assertTrue($result instanceof Zend_Auth_Result);
             $this->assertTrue($result->isValid());
             $this->assertTrue($result->getCode() == Zend_Auth_Result::SUCCESS);
             $this->assertTrue($result->getIdentity() === $formName);
         }
     }
 }
 /**
  * set loginname
  *
  * @param string $_identity
  * @return Tinebase_Auth_Ldap
  */
 public function setIdentity($_identity)
 {
     parent::setUsername($_identity);
     return $this;
 }