Skip to content
Snippets Groups Projects
Commit b4b7295b authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

fixed iteration problem with LDAP

parent 4a61bd39
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ public class Server { ...@@ -61,7 +61,7 @@ public class Server {
userAuthenticationModule.attachLDAPAuthSource(new String(path.readAllBytes())); userAuthenticationModule.attachLDAPAuthSource(new String(path.readAllBytes()));
UserProfile[] userProfile = userAuthenticationModule.getAuthenticationSources() UserProfile[] userProfile = userAuthenticationModule.getAuthenticationSources()
.get(new AuthModuleKey("savoirfairelinux", AuthenticationSourceType.LDAP)) .get(new AuthModuleKey("savoirfairelinux", AuthenticationSourceType.LDAP))
.getUserProfile("Félix","FULL_TEXT_NAME"); .getUserProfile("Béraud","FULL_TEXT_NAME");
System.out.println(userProfile[0]); System.out.println(userProfile[0]);
} catch (Exception e) { } catch (Exception e) {
log.error("Could not load and inject active directory connector with error: " + e.toString()); log.error("Could not load and inject active directory connector with error: " + e.toString());
......
...@@ -44,7 +44,7 @@ public class UserProfileService { ...@@ -44,7 +44,7 @@ public class UserProfileService {
SearchResponse res = search.execute(buildRequest(queryString,field)); SearchResponse res = search.execute(buildRequest(queryString,field));
if (res.getEntries().size() > 0) profiles = new UserProfile[res.getEntries().size()]; if (res.getEntries().size() > 0) profiles = new UserProfile[res.getEntries().size()];
for(int i=0; i< profiles.length; i++){ for(int i=0; i< profiles.length; i++){
profiles[i] = profileFromResponse(res.getEntry()); profiles[i] = profileFromResponse(res.getEntries().iterator().next());
} }
return profiles; return profiles;
} catch (Exception e) { } catch (Exception e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment