public function authenticate() { $ldapAdapter = new ZendLdapAdapter($this->options['servers'], $this->getIdentity(), $this->getCredential()); $result = $ldapAdapter->authenticate(); if (!$result->isValid()) { return $result; } $zourceAdapter = new Zource($this->entityManager, 'ldap', null); $zourceAdapter->setIdentity($result->getIdentity()); return $zourceAdapter->authenticate(); }
public function authenticate($username = null, $password = null) { if (self::$configFile === null) { throw SlimAuthException::configFileIsNotSet(); } //TODO check what Zend Exceptions may occour, if any, and enclose in SlimAuthException messages $configReader = new \Zend\Config\Reader\Ini(); $configData = $configReader->fromFile(self::$configFile); $config = new \Zend\Config\Config($configData, false); $options = $config->ldapauth->ldap->toArray(); $this->setOptions($options); $this->setUsername($username); $this->setPassword($password); return parent::authenticate(); }
public function testAccountObjectRetrievalWithOmittedAttributes() { $adapter = new Adapter\Ldap(array($this->options), TESTS_ZEND_LDAP_ALT_USERNAME, TESTS_ZEND_LDAP_ALT_PASSWORD); $result = $adapter->authenticate(); $account = $adapter->getAccountObject(array(), array('userPassword')); $this->assertInternalType('object', $account); $this->assertFalse(isset($account->userpassword)); }