Author: bdaw
Date: 2010-08-09 10:18:55 -0400 (Mon, 09 Aug 2010)
New Revision: 346
Modified:
idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java
Log:
- PLIDM-21 - LDAP search is not case sensitive
Modified:
idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java
===================================================================
---
idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java 2010-08-09
11:17:53 UTC (rev 345)
+++
idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java 2010-08-09
14:18:55 UTC (rev 346)
@@ -149,6 +149,12 @@
assertEquals(0, results.size());
+ // Check case sensitive checks
+
+ assertNull(testContext.getStore().findIdentityObject(testContext.getCtx(),
"adam", IdentityTypeEnum.USER));
+ assertNull(testContext.getStore().findIdentityObject(testContext.getCtx(),
"ADAM", IdentityTypeEnum.USER));
+ assertNull(testContext.getStore().findIdentityObject(testContext.getCtx(),
"deVISIon3", IdentityTypeEnum.ORGANIZATION));
+
testContext.commit();
}
Modified:
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-08-09
11:17:53 UTC (rev 345)
+++
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-08-09
14:18:55 UTC (rev 346)
@@ -627,6 +627,13 @@
String dn = ctx.getNameInNamespace();
IdentityObject io = createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn);
ctx.close();
+
+ // Check for case insensitive name results
+ if (!io.getName().equals(name))
+ {
+ io = null;
+ }
+
return io;
}
Modified:
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java
===================================================================
---
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java 2010-08-09
11:17:53 UTC (rev 345)
+++
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java 2010-08-09
14:18:55 UTC (rev 346)
@@ -22,8 +22,11 @@
package org.picketlink.idm.impl.api;
+import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.User;
import org.picketlink.idm.impl.LDAPTestPOJO;
+import org.picketlink.idm.impl.api.model.SimpleUser;
import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
@@ -117,4 +120,24 @@
{
roleQueryTest.testQuery(getRealmName());
}
+
+ public void testCaseSensitiveNames() throws Exception
+ {
+ IdentitySession session =
identitySessionFactory.createIdentitySession(getRealmName());
+
+ begin();
+
+ User aaa = session.getPersistenceManager().createUser("aaa");
+ session.getAttributesManager().updatePassword(aaa, "bbb");
+
+ assertNull(session.getPersistenceManager().findUser("bbb"));
+ assertNotNull(session.getPersistenceManager().findUser("aaa"));
+ assertNull(session.getPersistenceManager().findUser("aAa"));
+
+ session.getAttributesManager().validatePassword(new SimpleUser("aAa"),
"bbb");
+
+ assertNull(session.getPersistenceManager().findUser("aAa"));
+
+ commit();
+ }
}
\ No newline at end of file
Show replies by date