Commit da43feb3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1404-ldap-user-account-must-be-lower-case' into 'devel_15.1.x'

fix ldap connection for upper case letters

See merge request !1250
parents 05e3e6a4 e43ee88c
Pipeline #33534 passed with stage
in 13 minutes and 15 seconds
minerva (15.1.0) unstable; urgency=medium
* Bug fix: LDAP connection did not work properly where uid in LDAP/AD
contained upper case letters (#1404)
minerva (15.1.0~beta.1) unstable; urgency=medium
* Small improvement: "Human Disease Ontology", "IUPHAR ligand" and "Protein
Modification Ontology" annotation types are handled (#1359)
......
......@@ -157,7 +157,11 @@ public class LdapService implements ILdapService {
Attribute uid = entry.getAttribute(uidAttribute);
if (uid != null) {
result.setLogin(uid.getValue());
String remoteLogin = uid.getValue();
if (remoteLogin != null) {
remoteLogin = remoteLogin.toLowerCase();
}
result.setLogin(remoteLogin);
} else {
logger.warn("Invalid ldap entry: " + entry);
}
......
......@@ -44,6 +44,7 @@ public class LdapServiceTest extends ServiceTestFunctions {
// Create the configuration to use for the server.
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig("dc=uni,dc=lu");
config.addAdditionalBindCredentials("uid=piotr.gawron,cn=users,cn=accounts,dc=uni,dc=lu", "test_passwd");
config.addAdditionalBindCredentials("uid=UPPER,cn=users,cn=accounts,dc=uni,dc=lu", "test_passwd");
config.setSchema(null);
// Create the directory server instance, populate it with data from the
......@@ -80,10 +81,17 @@ public class LdapServiceTest extends ServiceTestFunctions {
assertFalse(ldapService.login("piotr.gawron", "invalid_password"));
}
@Test
public void testLoginCaseInsensitive() throws Exception {
assertTrue(ldapService.login("upper", "test_passwd"));
UserDTO user = ldapService.getUserByLogin("upper");
assertEquals("upper", user.getLogin());
}
@Test
public void testGetUsernames() throws Exception {
List<String> list = ldapService.getUsernames();
assertEquals(2, list.size());
assertEquals(3, list.size());
assertTrue(list.contains("piotr.gawron"));
assertFalse(list.contains("john.doe"));
}
......
......@@ -126,3 +126,81 @@ memberOf: ipaUniqueID=929b4e02-854b-11e6-b870-001a4ae5127c,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=bf23444e-a1bf-11e6-bf86-001a4ae5121e,cn=sudorules,cn=s
udo,dc=uni,dc=lu
dn: uid=UPPER,cn=users,cn=accounts,dc=uni,dc=lu
objectClass: mepOriginEntry
objectClass: ipaSshGroupOfPubKeys
objectClass: posixaccount
objectClass: inetuser
objectClass: krbprincipalaux
objectClass: krbticketpolicyaux
objectClass: organizationalperson
objectClass: inetorgperson
objectClass: ipasshuser
objectClass: top
objectClass: person
objectClass: ipaobject
cn: Piotr Gawron
gidNumber: 369550501
homeDirectory: /home/UPPER
ipaUniqueID: adf723e6-20e4-11e5-8907-001a4ae51219
sn: Gawron
uid: UPPER
uidNumber: 369550501
displayName: Piotr Gawron
gecos: Piotr Gawron
givenName: Piotr
initials: PG
krbLastPwdChange: 20180608111630Z
krbPasswordExpiration: 20190223111630Z
krbPrincipalName: piotr.gawron@UNI.LU
loginShell: /bin/bash
mail: piotr.gawron@uni.lu
memberOf: cn=lcsb,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: ipaUniqueID=d7549fa2-03a2-11e5-95f9-00163e0a4f7b,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=eff7677e-03a2-11e5-add5-00163e0a4f7b,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: ipaUniqueID=f10ec0f6-7ef6-11e5-957b-001a4ae5121e,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=2cf9b59e-7ef7-11e5-89c0-001a4ae5121e,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: ipaUniqueID=eeb5f68e-9775-11e5-81fb-00163e0a4f7b,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=176f7fb4-9776-11e5-a097-00163e0a4f7b,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: ipaUniqueID=7dda82ae-99e1-11e5-834b-001a4ae5121e,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=a44d842c-99e1-11e5-9c2f-001a4ae5121e,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: cn=webdav-public-minerva,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: ipaUniqueID=1d1f58b8-a247-11e5-ac5d-00163e0a4f7b,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=41f879a8-a247-11e5-9d34-00163e0a4f7b,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: ipaUniqueID=33e9e6a2-c8d1-11e5-b578-001a4ae5121e,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=572fea30-c8d1-11e5-b770-001a4ae5121e,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: cn=lcsb-biocore,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=gitlab,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=xwiki,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=xwiki-biocore,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=webdav-public-biocore,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=grafana-biocore-gitlab-viewers,cn=groups,cn=accounts,dc=uni,dc=
lu
memberOf: cn=grafana-biocore-icinga-viewers,cn=groups,cn=accounts,dc=uni,dc=
lu
memberOf: ipaUniqueID=634b5286-3781-11e6-93c5-001a4ae5121e,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=7fe6a210-3781-11e6-b515-001a4ae5121e,cn=sudorules,cn=s
udo,dc=uni,dc=lu
memberOf: cn=ncer-pd-ada,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: cn=r3lab-docker,cn=groups,cn=accounts,dc=uni,dc=lu
memberOf: ipaUniqueID=390a3ce0-854b-11e6-85c3-001a4ae5127c,cn=hbac,dc=uni,dc
=lu
memberOf: ipaUniqueID=6d558608-854b-11e6-9aa7-001a4ae5127c,cn=sudorules,cn=s
udo,dc=uni,dc=lu
telephoneNumber: +3524666445526
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment