1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Resolve LDAP registration DAO exception due to empty username

Summary:
When logging in as an LDAP user for the first time (thus registering), a DAO exception was being thrown because PhabricatorLDAPRegistrationController wasn't passing in a username to PhabricatorUser::setUsername().

Somewhat separately, since either the PHP LDAP extension's underlying library or Active Directory are returning attributes with lowercased key names, I have to search on sAMAccountName and look for the key samaccountname in the results; this is fine since the config allows these to be defined separately. However I found that PhabricatorLDAPProvider::retrieveUserName() was attempting to use the search attribute rather than the username attribute. This resolves.

Test Plan: Tested registration and login against our internal AD infrastructure; worked perfectly. Need help from someone with access to a functional non-AD LDAP implementation; I've added the original author and CCs from D2722 in case they can help test in this regard.

Reviewers: epriestley, voldern

Reviewed By: voldern

CC: voldern, aran, Korvin, auduny, svemir

Differential Revision: https://secure.phabricator.com/D3340
This commit is contained in:
Brian Cline 2012-08-24 08:42:16 -07:00 committed by epriestley
parent 5a0b640ccd
commit b0802a7797
2 changed files with 2 additions and 2 deletions

View file

@ -50,7 +50,7 @@ extends PhabricatorAuthController {
$e_realname = true;
$user = new PhabricatorUser();
$user->setUsername();
$user->setUsername($provider->retrieveUsername());
$user->setRealname($provider->retrieveUserRealName());
$new_email = $provider->retrieveUserEmail();

View file

@ -99,7 +99,7 @@ final class PhabricatorLDAPProvider {
}
public function retrieveUsername() {
return $this->userData[$this->getSearchAttribute()][0];
return $this->userData[$this->getUsernameAttribute()][0];
}
public function getConnection() {