diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index bfe54a7..50d52f0 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -79,8 +79,8 @@ private function addRoleNode() ->scalarNode('user_attribute')->defaultValue('member')->end() ->scalarNode('user_id')->defaultValue('dn') ->validate() - ->ifNotInArray(array('dn', 'username')) - ->thenInvalid('Only dn or username') + ->ifNotInArray(array('dn', 'username', 'uid')) + ->thenInvalid('Only dn, username or uid') ->end() ->end() ->end() diff --git a/Manager/LdapManagerUser.php b/Manager/LdapManagerUser.php index 6ba8953..5c74eda 100644 --- a/Manager/LdapManagerUser.php +++ b/Manager/LdapManagerUser.php @@ -41,14 +41,14 @@ public function auth() if (strlen($this->password) === 0) { throw new ConnectionException('Password can\'t be empty'); } - + if (null === $this->ldapUser) { $this->bindByUsername(); $this->doPass(); } else { $this->doPass(); $this->bindByDn(); - } + } } /** @@ -276,6 +276,10 @@ private function getUserId() return $this->username; break; + case 'uid': + return $this->username; + break; + default: throw new \Exception(sprintf("The value can't be retrieved for this user_id : %s",$this->params['role']['user_id'])); }