[jboss-cvs] Picketlink SVN: r253 - in idm/trunk: assembly and 22 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 20 17:26:09 EDT 2010


Author: bdaw
Date: 2010-05-20 17:26:08 -0400 (Thu, 20 May 2010)
New Revision: 253

Modified:
   idm/trunk/assembly/pom.xml
   idm/trunk/example/auth-simple/pom.xml
   idm/trunk/example/auth/pom.xml
   idm/trunk/example/simple/pom.xml
   idm/trunk/integration/deployer/pom.xml
   idm/trunk/integration/jboss5/pom.xml
   idm/trunk/integration/pom.xml
   idm/trunk/parent/pom.xml
   idm/trunk/picketlink-idm-api/pom.xml
   idm/trunk/picketlink-idm-auth/pom.xml
   idm/trunk/picketlink-idm-cache/pom.xml
   idm/trunk/picketlink-idm-common/pom.xml
   idm/trunk/picketlink-idm-core/pom.xml
   idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java
   idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java
   idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
   idm/trunk/picketlink-idm-docs/pom.xml
   idm/trunk/picketlink-idm-hibernate/pom.xml
   idm/trunk/picketlink-idm-ldap/pom.xml
   idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
   idm/trunk/picketlink-idm-spi/pom.xml
   idm/trunk/picketlink-idm-testsuite/pom.xml
   idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java
   idm/trunk/pom.xml
Log:
- prepare 1.1.5.CR01
- PLIDM-15 Problem when LDAP DN contains slash

Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/assembly/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -4,14 +4,14 @@
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.picketlink.idm</groupId>
    <artifactId>picketlink-idm</artifactId>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>PicketLink IDM Assembly </name>
 	
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
 

Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/example/auth/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.picketlink.idm.example</groupId>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <artifactId>example-auth</artifactId>
    <packaging>jar</packaging>
    <name>Example - JEE authentication</name>

Modified: idm/trunk/example/auth-simple/pom.xml
===================================================================
--- idm/trunk/example/auth-simple/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/example/auth-simple/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.picketlink.idm.example</groupId>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <artifactId>example-auth-simple</artifactId>
    <packaging>jar</packaging>
    <name>Example - JEE authentication (using deployer)</name>

Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/example/simple/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.picketlink.idm.example</groupId>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <artifactId>example-simple</artifactId>
    <packaging>jar</packaging>
    <name>Example - Simple PicketLink IDM Maven2 project</name>

Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/integration/deployer/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -8,12 +8,12 @@
    <groupId>org.picketlink.idm.integration</groupId>
    <artifactId>picketlink-idm-jboss5-deployer</artifactId>
    <packaging>jar</packaging>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
   
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-integration</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
    </parent>
 
    <properties>

Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/integration/jboss5/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -8,12 +8,12 @@
    <groupId>org.picketlink.idm.integration</groupId>
    <artifactId>picketlink-idm-jboss5</artifactId>
    <packaging>jar</packaging>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
   
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-integration</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
    </parent>
 
    <dependencies>

Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/integration/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -13,7 +13,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent/pom.xml</relativePath>
    </parent>
 

Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/parent/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -8,7 +8,7 @@
    <groupId>org.picketlink.idm</groupId>
    <artifactId>picketlink-idm-parent</artifactId>
    <packaging>pom</packaging>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <name>PicketLink IDM- Parent</name>
    <url>http://labs.jboss.org/portal/jbosssecurity/</url>
    <description>PicketLink is a cross-cutting project that handles identity  needs for the JEMS projects</description>

Modified: idm/trunk/picketlink-idm-api/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-api/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-api/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-auth/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-auth/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-auth/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-cache/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-cache/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-cache/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-common/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-common/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-common/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-core/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-core/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-core/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java	2010-05-20 21:26:08 UTC (rev 253)
@@ -48,7 +48,8 @@
  * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
  * @version : 0.1 $
  */
-public abstract class AbstractManager 
+public abstract class
+   AbstractManager 
    implements Serializable
 {
    protected final IdentitySessionImpl identitySession;
@@ -275,10 +276,17 @@
    {
       //TODO: extract this, let to define broader set of constraints and apply also in the
       //TODO: SPI to filter what comes fromdata stores
-      if (name.contains("/"))
+
+      
+      if (name.contains(GroupKey.SEPARATOR))
       {
-         throw new IllegalArgumentException("name cannot contain '/' character");
+         throw new IllegalArgumentException("name cannot contain '" + GroupKey.SEPARATOR  + "' character sequence");
       }
+
+      if (name.contains(GroupKey.PREFIX))
+      {
+         throw new IllegalArgumentException("name cannot contain '" + GroupKey.PREFIX  + "' character sequence");
+      }
    }
 
    public void preCreate(IdentityType identityType)

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-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/CommonIdentityStoreTest.java	2010-05-20 21:26:08 UTC (rev 253)
@@ -99,8 +99,23 @@
       assertEquals(0, testContext.getStore().getIdentityObjectsCount(testContext.getCtx(), IdentityTypeEnum.USER));
       assertEquals(0, testContext.getStore().getIdentityObjectsCount(testContext.getCtx(), IdentityTypeEnum.ORGANIZATION));
 
+      // Check special characters:
+
+
+      user1 = testContext.getStore().createIdentityObject(testContext.getCtx(), "Adam/Ewa/Toto", IdentityTypeEnum.USER);
+
+      assertNotNull(testContext.getStore().findIdentityObject(testContext.getCtx(), "Adam/Ewa/Toto", IdentityTypeEnum.USER));
+
+      user1 = testContext.getStore().createIdentityObject(testContext.getCtx(), "Adam//Ewa////Toto*%.$", IdentityTypeEnum.USER);
+
+      assertNotNull(testContext.getStore().findIdentityObject(testContext.getCtx(), "Adam//Ewa////Toto*%.$", IdentityTypeEnum.USER));
+
+
+
       testContext.commit();
 
+
+
    }
 
    public void testFindMethods() throws Exception

Modified: idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../../parent</relativePath>
    </parent>
 

Modified: idm/trunk/picketlink-idm-docs/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-docs/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-docs/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
 <parent>
    <groupId>org.picketlink.idm</groupId>
    <artifactId>picketlink-idm-parent</artifactId>
-   <version>1.1.4.GA</version>
+   <version>1.1.5.CR01-SNAPSHOT</version>
    <relativePath>../parent</relativePath>
 </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-hibernate/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-hibernate/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-hibernate/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-ldap/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-ldap/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-ldap/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

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-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java	2010-05-20 21:26:08 UTC (rev 253)
@@ -70,8 +70,10 @@
 import java.util.logging.Logger;
 import java.util.regex.Pattern;
 
+import javax.naming.CompositeName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -342,8 +344,11 @@
       try
       {
          //  If there are many contexts specified in the configuration the first one is used
-         LdapContext ctx = (LdapContext)ldapContext.lookup(getTypeConfiguration(invocationCtx, type).getCtxDNs()[0]);
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(getTypeConfiguration(invocationCtx, type).getCtxDNs()[0]);
 
+         LdapContext ctx = (LdapContext)ldapContext.lookup(jndiName);
+
          //We store new entry using set of attributes. This should give more flexibility then
          //extending identity object from ContextDir - configure what objectClass place there
          Attributes attrs = new BasicAttributes(true);
@@ -462,8 +467,11 @@
       try
       {
          log.finer("removing entry: " + dn);
-         ldapContext.unbind(dn);
 
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(dn);
+         ldapContext.unbind(jndiName);
+
          invalidateCache();
       }
       catch (Exception e)
@@ -721,7 +729,8 @@
 
          // Grab entry
 
-         Attributes attrs = ldapContext.getAttributes(dn);
+         Name jndiName = new CompositeName().add(dn);
+         Attributes attrs = ldapContext.getAttributes(jndiName);
 
          if (attrs == null)
          {
@@ -976,7 +985,8 @@
             {
 
 
-               Attributes attrs = ldapContext.getAttributes(ldapIO.getDn());
+               Name jndiName = new CompositeName().add(ldapIO.getDn());
+               Attributes attrs = ldapContext.getAttributes(jndiName);
                Attribute member = attrs.get(typeConfig.getParentMembershipAttributeName());
 
                if (member != null)
@@ -1042,7 +1052,9 @@
             }
             else
             {
-               Attributes attrs = ldapContext.getAttributes(ldapIO.getDn());
+               // Escape JNDI special characters
+               Name jndiName = new CompositeName().add(ldapIO.getDn());
+               Attributes attrs = ldapContext.getAttributes(jndiName);
                Attribute member = attrs.get(typeConfig.getChildMembershipAttributeName());
 
                if (member != null)
@@ -1330,7 +1342,9 @@
          // If parent simply look for all its members
          if (parent)
          {
-            Attributes attrs = ldapContext.getAttributes(ldapIO.getDn());
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapIO.getDn());
+            Attributes attrs = ldapContext.getAttributes(jndiName);
 
             if (typeConfig.getParentMembershipAttributeName() != null )
             {
@@ -1381,7 +1395,9 @@
          // if not parent then all parent entries need to be found
          else
          {
-            Attributes attrs = ldapContext.getAttributes(ldapIO.getDn());
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapIO.getDn());
+            Attributes attrs = ldapContext.getAttributes(jndiName);
 
             if (typeConfig.getChildMembershipAttributeName() != null)
             {
@@ -1675,7 +1691,9 @@
 
             attrs.put(member);
 
-            ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.ADD_ATTRIBUTE, attrs);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapFromIO.getDn());
+            ldapContext.modifyAttributes(jndiName, DirContext.ADD_ATTRIBUTE, attrs);
 
             invalidateCache();
          }
@@ -1696,7 +1714,9 @@
 
             attrs.put(member);
 
-            ldapContext.modifyAttributes(ldapToIO.getDn(), DirContext.ADD_ATTRIBUTE, attrs);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapToIO.getDn());
+            ldapContext.modifyAttributes(jndiName, DirContext.ADD_ATTRIBUTE, attrs);
 
             invalidateCache();
          }
@@ -1792,7 +1812,9 @@
 
             attrs.put(member);
 
-            ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REMOVE_ATTRIBUTE, attrs);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapFromIO.getDn());
+            ldapContext.modifyAttributes(jndiName, DirContext.REMOVE_ATTRIBUTE, attrs);
 
             invalidateCache();
          }
@@ -1812,7 +1834,9 @@
 
             attrs.put(member);
 
-            ldapContext.modifyAttributes(ldapToIO.getDn(), DirContext.REMOVE_ATTRIBUTE, attrs);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapToIO.getDn());
+            ldapContext.modifyAttributes(jndiName, DirContext.REMOVE_ATTRIBUTE, attrs);
 
             invalidateCache();
          }
@@ -1905,7 +1929,9 @@
 
       try
       {
-         Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(ldapFromIO.getDn());
+         Attributes attrs = ldapContext.getAttributes(jndiName);
 
          if (fromTypeConfig.getParentMembershipAttributeName() != null)
          {
@@ -1995,8 +2021,11 @@
 
       try
       {
+
          //  If there are many contexts specified in the configuration the first one is used
-         LdapContext ctx = (LdapContext)ldapContext.lookup(getConfiguration(invocationCtx).getRelationshipNamesCtxDNs()[0]);
+         //  Escape JNDI special characters
+         Name jndiName = new CompositeName().add(getConfiguration(invocationCtx).getRelationshipNamesCtxDNs()[0]);
+         LdapContext ctx = (LdapContext)ldapContext.lookup(jndiName);
 
          Attributes attrs = new BasicAttributes(true);
 
@@ -2121,7 +2150,9 @@
          ctx = (Context)res.getObject();
          String dn = ctx.getNameInNamespace();
 
-         ctx.unbind(dn);
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(dn);
+         ctx.unbind(jndiName);
 
          invalidateCache();
 
@@ -2519,7 +2550,9 @@
 
             }
 
-            ldapContext.modifyAttributes(ldapIO.getDn(), DirContext.REPLACE_ATTRIBUTE, attrs);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(ldapIO.getDn());
+            ldapContext.modifyAttributes(jndiName, DirContext.REPLACE_ATTRIBUTE, attrs);
 
             invalidateCache();
          }
@@ -2623,7 +2656,9 @@
 
          String dn = ldapIdentity.getDn();
 
-         Attributes attrs = ldapContext.getAttributes(dn);
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(dn);
+         Attributes attrs = ldapContext.getAttributes(jndiName);
 
          for (Iterator iterator = mappedNames.iterator(); iterator.hasNext();)
          {
@@ -2779,7 +2814,9 @@
 
                try
                {
-                  ldapContext.modifyAttributes(dn, DirContext.REPLACE_ATTRIBUTE, attrs);
+                  // Escape JNDI special characters
+                  Name jndiName = new CompositeName().add(dn);
+                  ldapContext.modifyAttributes(jndiName, DirContext.REPLACE_ATTRIBUTE, attrs);
 
                   invalidateCache();
                }
@@ -2913,7 +2950,9 @@
 
                try
                {
-                  ldapContext.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
+                  // Escape JNDI special characters
+                  Name jndiName = new CompositeName().add(dn);
+                  ldapContext.modifyAttributes(jndiName, DirContext.ADD_ATTRIBUTE, attrs);
 
                   invalidateCache();
                }
@@ -3015,7 +3054,9 @@
 
             try
             {
-               ldapContext.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);
+               // Escape JNDI special characters
+               Name jndiName = new CompositeName().add(dn);
+               ldapContext.modifyAttributes(jndiName, DirContext.REMOVE_ATTRIBUTE, attrs);
 
                invalidateCache();
             }
@@ -3304,13 +3345,16 @@
 
          if (entryCtxs.length == 1)
          {
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(entryCtxs[0]);
+
             if (filterArgs == null)
             {
-               results = ldapContext.search(entryCtxs[0], filter, searchControls);
+               results = ldapContext.search(jndiName, filter, searchControls);
             }
             else
             {
-               results = ldapContext.search(entryCtxs[0], filter, filterArgs, searchControls);
+               results = ldapContext.search(jndiName, filter, filterArgs, searchControls);
             }
 
             List toReturn = Tools.toList(results);
@@ -3330,13 +3374,17 @@
 
             for (String entryCtx : entryCtxs)
             {
+
+               // Escape JNDI special characters
+               Name jndiName = new CompositeName().add(entryCtx);
+
                if (filterArgs == null)
                {
-                  results = ldapContext.search(entryCtx, filter, searchControls);
+                  results = ldapContext.search(jndiName, filter, searchControls);
                }
                else
                {
-                  results = ldapContext.search(entryCtx, filter, filterArgs, searchControls);
+                  results = ldapContext.search(jndiName, filter, filterArgs, searchControls);
                }
                List singleResult = Tools.toList(results);
 
@@ -3556,7 +3604,9 @@
 
          try
          {
-            root = (DirContext)ctx.lookup(rootDN);
+            // Escape JNDI special characters
+            Name jndiName = new CompositeName().add(rootDN);
+            root = (DirContext)ctx.lookup(jndiName);
          }
          catch (NamingException e)
          {
@@ -3622,7 +3672,9 @@
       DirContext subContext = null;
       try
       {
-         subContext = (LdapContext)ctx.lookup(dn);
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(dn);
+         subContext = (LdapContext)ctx.lookup(jndiName);
       }
       catch (NamingException e)
       {
@@ -3674,7 +3726,9 @@
 
       try
       {
-         subContext = ctx.createSubcontext(dn, attrs);
+         // Escape JNDI special characters
+         Name jndiName = new CompositeName().add(dn);
+         subContext = ctx.createSubcontext(jndiName, attrs);
 
       }
       finally

Modified: idm/trunk/picketlink-idm-spi/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-spi/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-spi/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-testsuite/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-testsuite/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-testsuite/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -2,7 +2,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

Modified: idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java
===================================================================
--- idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java	2010-05-20 21:26:08 UTC (rev 253)
@@ -29,6 +29,7 @@
 import org.picketlink.idm.api.IdentitySearchCriteria;
 
 import junit.framework.Assert;
+import org.picketlink.idm.impl.api.model.GroupKey;
 
 /**
  *
@@ -81,7 +82,7 @@
 
       try
       {
-         session.getPersistenceManager().createUser("lol/olo");
+         session.getPersistenceManager().createUser("lol" + GroupKey.SEPARATOR + "lolo");
          fail();
       }
       catch (IllegalArgumentException e)
@@ -91,7 +92,7 @@
 
       try
       {
-         session.getPersistenceManager().createGroup("/toto", ORGANIZATION);
+         session.getPersistenceManager().createGroup(GroupKey.PREFIX + "toto", ORGANIZATION);
          fail();
       }
       catch (IllegalArgumentException e)

Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml	2010-05-19 17:48:31 UTC (rev 252)
+++ idm/trunk/pom.xml	2010-05-20 21:26:08 UTC (rev 253)
@@ -3,7 +3,7 @@
    <parent>
       <groupId>org.picketlink.idm</groupId>
       <artifactId>picketlink-idm-parent</artifactId>
-      <version>1.1.4.GA</version>
+      <version>1.1.5.CR01-SNAPSHOT</version>
       <relativePath>parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>




More information about the jboss-cvs-commits mailing list