예제 #1
0
 private function loadUser($username, Entry $entry)
 {
     return new User($username, $entry->getAttribute('userpassword'), $this->defaultRoles);
 }
예제 #2
0
 /**
  * Fetches the password from an LDAP entry.
  *
  * @param null|Entry $entry
  */
 private function getPassword(Entry $entry)
 {
     if (null === $this->passwordAttribute) {
         return;
     }
     if (!$entry->hasAttribute($this->passwordAttribute)) {
         throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $this->passwordAttribute, $entry->getDn()));
     }
     $values = $entry->getAttribute($this->passwordAttribute);
     if (1 !== count($values)) {
         throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $this->passwordAttribute));
     }
     return $values[0];
 }