Merge pull request #476 from mposolda/beta-3-testing

Improvement for AD integration to avoid exception when mulitple users wi...
This commit is contained in:
Stian Thorgersen 2014-06-19 13:02:36 +01:00
commit efcb7ee110

View file

@ -51,9 +51,15 @@ public class PicketlinkAuthenticationProvider implements AuthenticationProvider
try {
User picketlinkUser = BasicModel.getUser(identityManager, username);
return picketlinkUser == null ? null : new AuthUser(picketlinkUser.getId(), picketlinkUser.getLoginName(), getName())
if (picketlinkUser == null) {
return null;
}
String email = (picketlinkUser.getEmail() != null && picketlinkUser.getEmail().trim().length() > 0) ? picketlinkUser.getEmail() : null;
return new AuthUser(picketlinkUser.getId(), picketlinkUser.getLoginName(), getName())
.setName(picketlinkUser.getFirstName(), picketlinkUser.getLastName())
.setEmail(picketlinkUser.getEmail())
.setEmail(email)
.setProviderName(getName());
} catch (IdentityManagementException ie) {
throw convertIDMException(ie);