/** * @param array $configuration */ public function __construct(array $configuration) { $this->configuration = $configuration; $this->adapter = new Ldap(); $this->adapter->setOptions($configuration['config']); $this->setMapping($configuration['mapping']); }
public function createService(ServiceLocatorInterface $serviceLocator) { $service = $serviceLocator->get('UghAuthenticationLdap\\Ldap\\Ldap'); $adapter = new Ldap(); $adapter->setLdap($service); return $adapter; }
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 __construct($config) { $callback = function ($passwordInDatabase, $passwordProvided) { return password_verify($passwordProvided, $passwordInDatabase); }; parent::__construct(array('server1' => array('host' => $config['host'], 'port' => $config['port'], 'useStartTls' => $config['useStartTls'], 'accountDomainName' => $config['accountDomainName'], 'accountDomainNameShort' => $config['accountDomainNameShort'], 'accountCanonicalForm' => $config['accountCanonicalForm'], 'baseDn' => $config['baseDn']))); }
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)); }
public function testSetCredentialProxiesToSetPassword() { $passwordExpected = 'somePassword'; $passwordActual = $this->adapter->setCredential($passwordExpected)->getPassword(); $this->assertSame($passwordExpected, $passwordActual); }