DerManoMann / ldap-auth-service-provider

A Silex Ldap authentication service provider
MIT License
5 stars 2 forks source link

Need DN to authenticate #15

Closed matracine closed 8 years ago

matracine commented 8 years ago

Hello, context : openldap with anonymous bind for retrieve users. First phase woking perfectly, the user is found in Ldap. During second phase, check password bind, username must be complete DN and not only username (uid=myusername, ou=people, ...., c=FR, dc=myorg, dc=fr). In LdapAuthenticationProvider code : $this->ldapAuth($token->getUserName(), $token->getCredentials()) is retrieving user name. I have to change it to : $this->ldapAuth($user->getdn(), $token->getCredentials())

In service configuration, I added : 'attr' => array('dn' => 'dn') to retreive the DN. Had to change also : $user->$method($userData[$key][0]); to $user->$method($userData[$key]); to be able to retrieve the DN. Is this a bug or did I miss something ?

DerManoMann commented 8 years ago

Could you try the branch I just pushed? The tests are failing but that is unrelated, IMO :)

The defaults added should just make it work...

matracine commented 8 years ago

Hello, Thanks for this modification, but :

DerManoMann commented 8 years ago

Hmm, I'll have to think about that...

DerManoMann commented 8 years ago

I've separated the authName mapping from the custom attributes, so this should fix the conflict. Also figured why the tests were failing.. :)

Could you please try again?

matracine commented 8 years ago

Works like a charm. Tested with "symfony/security": "^3.1" ;)