directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r493959 [2/2] - in /directory/sandbox/triplesec-jacc2: admin-api/src/main/java/org/safehaus/triplesec/admin/ admin-api/src/main/java/org/safehaus/triplesec/admin/dao/ldap/ admin-api/src/test/java/org/safehaus/triplesec/admin/ guardian-api/s...
Date Mon, 08 Jan 2007 05:40:13 GMT
Modified: directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicy.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicy.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicy.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicy.java Sun Jan  7 21:40:11 2007
@@ -64,10 +64,8 @@
     private static final String[] PROF_ID = new String[] { "profileId" };
     /** the logger interface for this class */
     private static Logger log = LoggerFactory.getLogger( LdapApplicationPolicy.class );
-    /** the application base relative name to the context given: "appName=<applicationName\>,ou=applications" */
-    private final String baseRdn;
 
-    /** the JNDI Context at the base under which ou=applications can be found */
+    /** the realm JNDI Context at the base under which ou=applications can be found */
     private DirContext ctx;
     /** the profile for the admin user with all rights in all roles */
     private Profile adminProfile;
@@ -76,11 +74,11 @@
     /**
      * Creates an instance of the LDAP ApplicationPolicyStore.
      *
-     * @param ctx the base context under which ou=applications and ou=users can be found
-     * @param info additional information needed to
+     * @param ctx the realm base context under which ou=applications and ou=users can be found
+     * @param applicationRdn relative distinguished name for this app context inside ctx
      * @throws GuardianException if failures are encountered while loading objects from the backing store
      */
-    public LdapApplicationPolicy( DirContext ctx, Properties info ) throws GuardianException
+    public LdapApplicationPolicy( DirContext ctx, String applicationRdn ) throws GuardianException
     {
         if ( ctx == null )
         {
@@ -89,14 +87,8 @@
 
         this.ctx = ctx;
 
-        // extract the applicationName from the applicationPrincipalDN
-        applicationName = getApplicationName( info.getProperty( "applicationPrincipalDN" ) );
-
-        StringBuffer buf = new StringBuffer();
-        buf.append( "appName=" );
-        buf.append( applicationName );
-        buf.append( ",ou=applications" );
-        baseRdn = buf.toString();
+        // extract the applicationRdn from the applicationPrincipalDN
+        this.applicationRdn = applicationRdn;
 
         // load the set of permissions associated with this application
         loadPermissions();
@@ -110,7 +102,7 @@
 
         try
         {
-            Attributes appAttrs = this.ctx.getAttributes( baseRdn );
+            Attributes appAttrs = this.ctx.getAttributes( applicationRdn );
             Attribute descriptionAttr = appAttrs.get( "description" );
 
             if ( descriptionAttr == null || descriptionAttr.size() == 0 )
@@ -124,7 +116,7 @@
         }
         catch ( NamingException e )
         {
-            log.error( "failed to read application entry: appName=" + applicationName + ",ou=applications" );
+            log.error( "failed to read application entry: " + applicationRdn, e );
         }
 
         initializeNotifications();
@@ -139,7 +131,7 @@
         try
         {
             EventDirContext eventContext = ( EventDirContext ) ctx.lookup( "" );
-            eventContext.addNamingListener( baseRdn, "(objectClass=*)", controls, new JndiListener() );
+            eventContext.addNamingListener( applicationRdn, "(objectClass=*)", controls, new JndiListener() );
             return true;
         }
         catch ( NamingException e )
@@ -161,7 +153,7 @@
         buf.append( "roleName=" );
         buf.append( roleName );
         buf.append( ",ou=roles," );
-        buf.append( baseRdn );
+        buf.append( applicationRdn );
 
         try
         {
@@ -170,7 +162,7 @@
             {
                 SearchResult result = list.next();
                 Role role = getRole( result.getAttributes() );
-                log.debug( "fetching role '" + role.getName() + "' for application '" + applicationName + "'" );
+                log.debug( "fetching role '" + role.getName() + "' for application '" + applicationRdn + "'" );
                 return role;
             }
 
@@ -178,7 +170,7 @@
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on search to find roles for application " + applicationName;
+            String msg = "Failed on search to find roles for application " + applicationRdn;
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
@@ -198,26 +190,26 @@
 
         try
         {
-            NamingEnumeration<SearchResult> list = ctx.search( "ou=roles," + baseRdn,
+            NamingEnumeration<SearchResult> list = ctx.search( "ou=roles," + applicationRdn,
                     "(objectClass=policyRole)", ctrls );
             while ( list.hasMore() )
             {
                 SearchResult result = list.next();
                 Role role = getRole( result.getAttributes() );
                 roleSet.add( role );
-                log.debug( "loading role '" + role.getName() + "' for application '" + applicationName + "'" );
+                log.debug( "loading role '" + role.getName() + "' for application '" + applicationRdn + "'" );
             }
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on search to find roles for application " + applicationName;
+            String msg = "Failed on search to find roles for application " + applicationRdn;
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
 
         Role[] roleArray = new Role[roleSet.size()];
         roleArray = roleSet.toArray( roleArray );
-        this.roles = new Roles( applicationName, roleArray );
+        this.roles = new Roles( applicationRdn, roleArray );
     }
 
 
@@ -228,19 +220,19 @@
         ctrls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         try
         {
-            NamingEnumeration<SearchResult> list = ctx.search( "ou=permissions," + baseRdn,
+            NamingEnumeration<SearchResult> list = ctx.search( "ou=permissions," + applicationRdn,
                     "(objectClass=policyPermission)", ctrls );
             while ( list.hasMore() )
             {
                 SearchResult result = list.next();
                 PermissionEntry permEntry = loadPermission( result.getAttributes());
                 permissions.put(permEntry.getPermissionName(), permEntry.getPermission());
-                log.debug( "loading permission " + permEntry.getPermissionName() + " for application " + applicationName );
+                log.debug( "loading permission " + permEntry.getPermissionName() + " for application " + applicationRdn );
             }
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on search to find permissions for application " + applicationName;
+            String msg = "Failed on search to find permissions for application " + applicationRdn;
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
@@ -272,7 +264,7 @@
         NamingEnumeration<SearchResult> list = null;
         try
         {
-            list = ctx.search( "ou=profiles," + baseRdn, "(profileId=" + profileId + ")", ctrls );
+            list = ctx.search( "ou=profiles," + applicationRdn, "(profileId=" + profileId + ")", ctrls );
             if ( list.hasMore() )
             {
                 SearchResult result = list.next();
@@ -280,7 +272,7 @@
 
                 if ( log.isDebugEnabled() )
                 {
-                    log.debug( "loaded profile '" + profileId + "' in application '" + applicationName + "'" );
+                    log.debug( "loaded profile '" + profileId + "' in application '" + applicationRdn + "'" );
                 }
 
                 return profile;
@@ -290,7 +282,7 @@
                 if ( log.isInfoEnabled() )
                 {
                     log.info( "Profile search for profileId '" + profileId + "' in application '"
-                            + applicationName + "' failed to return an entry." );
+                            + applicationRdn + "' failed to return an entry." );
                 }
 
                 return null;
@@ -298,7 +290,7 @@
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on search to find profile for profileId '" + profileId + "' in '" + applicationName + "'";
+            String msg = "Failed on search to find profile for profileId '" + profileId + "' in '" + applicationRdn + "'";
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
@@ -365,7 +357,7 @@
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setReturningAttributes( PROF_ID );
 
-        String baseProfilesRdn = "ou=profiles," + this.baseRdn;
+        String baseProfilesRdn = "ou=profiles," + applicationRdn;
         NamingEnumeration<SearchResult> results;
         Set<String> profiles = new HashSet<String>();
         profiles.add( "admin" );
@@ -404,7 +396,7 @@
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setReturningAttributes( PROF_ID );
 
-        String baseProfilesRdn = "ou=profiles," + this.baseRdn;
+        String baseProfilesRdn = "ou=profiles," + applicationRdn;
         NamingEnumeration<SearchResult> results;
         Set<String> profiles = new HashSet<String>();
         profiles.add( "admin" );
@@ -514,12 +506,12 @@
             result = ( SearchResult ) evt.getNewBinding();
             String name = result.getName();
 
-            if ( name.indexOf( applicationName ) == -1 )
+            if ( name.indexOf( applicationRdn ) == -1 )
             {
                 if ( log.isWarnEnabled() )
                 {
                     log.warn( "Entry '" + name + "' ignored! " +
-                            "It is not specific to the application: " + applicationName );
+                            "It is not specific to the application: " + applicationRdn );
                 }
                 return;
             }
@@ -566,8 +558,8 @@
                     StringPermission newPermission = getPermission( entry );
                     StringPermission oldPermission = permissions.get( newPermission.getName() );
                     Roles dependentRoles = LdapApplicationPolicy.this.roles.getDependentRoles( oldPermission );
-                    Permissions newPermissions = new Permissions( applicationName, new StringPermission[] { newPermission } );
-                    Permissions oldPermissions = new Permissions( applicationName, new StringPermission[] { oldPermission } );
+                    Permissions newPermissions = new Permissions( applicationRdn, new StringPermission[] { newPermission } );
+                    Permissions oldPermissions = new Permissions( applicationRdn, new StringPermission[] { oldPermission } );
                     permissions = permissions.removeAll( oldPermissions );
                     permissions = permissions.addAll( newPermissions );
                     LdapApplicationPolicy.this.permissions = permissions;
@@ -584,13 +576,13 @@
                     }
                     Role[] oldRolesArray = new Role[oldRoleList.size()];
                     oldRolesArray = ( Role[] ) oldRoleList.toArray( oldRolesArray );
-                    Roles oldRoles = new Roles( applicationName, oldRolesArray );
+                    Roles oldRoles = new Roles( applicationRdn, oldRolesArray );
                     Roles roles = LdapApplicationPolicy.this.roles;
                     roles = roles.removeAll( oldRoles );
 
                     Role[] newRolesArray = new Role[newRoleList.size()];
                     newRolesArray = ( Role[] ) newRoleList.toArray( newRolesArray );
-                    Roles newRoles = new Roles( applicationName, newRolesArray );
+                    Roles newRoles = new Roles( applicationRdn, newRolesArray );
                     roles = roles.addAll( newRoles );
 
                     LdapApplicationPolicy.this.roles = roles;
@@ -616,9 +608,9 @@
 
                     Role newRole = getRole( entry );
                     Roles roles = LdapApplicationPolicy.this.roles;
-                    Roles oldRoles = new Roles( applicationName, new Role[] { roles.get( roleName ) } );
+                    Roles oldRoles = new Roles( applicationRdn, new Role[] { roles.get( roleName ) } );
                     roles = roles.removeAll( oldRoles );
-                    Roles newRoles = new Roles( applicationName, new Role[] { newRole } );
+                    Roles newRoles = new Roles( applicationRdn, new Role[] { newRole } );
                     roles = roles.addAll( newRoles );
                     LdapApplicationPolicy.this.roles = roles;
 
@@ -685,12 +677,12 @@
             String name = result.getName();
             logEvent( evt, entry );
 
-            if ( name.indexOf( applicationName ) == -1 )
+            if ( name.indexOf( applicationRdn ) == -1 )
             {
                 if ( log.isWarnEnabled() )
                 {
                     log.warn( "Entry '" + name + "' ignored! " +
-                            "It is not specific to the application: " + applicationName );
+                            "It is not specific to the application: " + applicationRdn );
                 }
                 return;
             }
@@ -760,12 +752,12 @@
             String name = result.getName();
             logEvent( evt, entry );
 
-            if ( name.indexOf( applicationName ) == -1 )
+            if ( name.indexOf( applicationRdn ) == -1 )
             {
                 if ( log.isWarnEnabled() )
                 {
                     System.out.println( "Entry '" + name + "' ignored! " +
-                            "It is not specific to the application: " + applicationName );
+                            "It is not specific to the application: " + applicationRdn );
                 }
                 return;
             }
@@ -838,12 +830,12 @@
             Attributes newEntry = ( ( SearchResult ) evt.getNewBinding() ).getAttributes();
             Attribute oc = newEntry.get( "objectClass" );
 
-            if ( oldName.indexOf( applicationName ) == -1 )
+            if ( oldName.indexOf( applicationRdn ) == -1 )
             {
                 if ( log.isWarnEnabled() )
                 {
                     System.out.println( "Entry '" + oldName + "' ignored! " +
-                            "It is not specific to the application: " + applicationName );
+                            "It is not specific to the application: " + applicationRdn );
                 }
                 return;
             }
@@ -940,7 +932,7 @@
 
     private void add( Role role )
     {
-        Roles addedRoles = new Roles( applicationName, new Role[] { role } );
+        Roles addedRoles = new Roles( applicationRdn, new Role[] { role } );
         this.roles = this.roles.addAll( addedRoles );
     }
 
@@ -948,7 +940,7 @@
     private Role removeRole( String roleName )
     {
         Role role = this.roles.get( roleName );
-        Roles removedRoles = new Roles( applicationName, new Role[] { role } );
+        Roles removedRoles = new Roles( applicationRdn, new Role[] { role } );
         this.roles = this.roles.removeAll( removedRoles );
         return role;
     }
@@ -972,7 +964,7 @@
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setReturningAttributes( PROF_ID );
 
-        String baseProfilesRdn = "ou=profiles," + this.baseRdn;
+        String baseProfilesRdn = "ou=profiles," + applicationRdn;
         NamingEnumeration<SearchResult> results;
         Set<String> profiles = new HashSet<String>();
 
@@ -1010,7 +1002,7 @@
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setReturningAttributes( PROF_ID );
 
-        String baseProfilesRdn = "ou=profiles," + this.baseRdn;
+        String baseProfilesRdn = "ou=profiles," + applicationRdn;
         NamingEnumeration<SearchResult> results;
         try
         {

Modified: directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapConnectionDriver.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapConnectionDriver.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapConnectionDriver.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldap/src/main/java/org/safehaus/triplesec/guardian/ldap/LdapConnectionDriver.java Sun Jan  7 21:40:11 2007
@@ -64,7 +64,7 @@
     {
         if ( info == null )
         {
-            info = new Properties();
+            throw new IllegalArgumentException( "A non-null properties object must be provided." );
         }
 
         if ( url == null )
@@ -84,12 +84,17 @@
             throw new IllegalArgumentException( "The applicationCredentials property must be provided" );
         }
 
+        String applicationRdn = info.getProperty("applicationRDN");
+        if (applicationRdn == null) {
+            throw new IllegalArgumentException( "The ApplicationRdn property must be provided" );
+        }
+
         Hashtable env = new Hashtable();
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
         env.put( Context.PROVIDER_URL, url );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.put( Context.SECURITY_PRINCIPAL, info.get( "applicationPrincipalDN" ) );
-        env.put( Context.SECURITY_CREDENTIALS, info.get( "applicationCredentials" ) );
+        env.put( Context.SECURITY_PRINCIPAL, application  );
+        env.put( Context.SECURITY_CREDENTIALS, password );
 
         InitialDirContext ictx = null;
         try
@@ -102,6 +107,6 @@
             throw new StoreConnectionException( "Failed to obtain initial context for " + env, e );
         }
 
-        return new LdapApplicationPolicy( ictx, info );
+        return new LdapApplicationPolicy( ictx, applicationRdn );
     }
 }

Modified: directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/GuardianClient.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/GuardianClient.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/GuardianClient.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/GuardianClient.java Sun Jan  7 21:40:11 2007
@@ -37,6 +37,7 @@
     {
         Properties props = new Properties();
         props.setProperty( "applicationPrincipalDN", "appName=mockApplication,ou=applications,dc=example,dc=com" );
+        props.setProperty( "applicationRDN", "appName=mockApplication,ou=applications" );
         props.setProperty( "applicationCredentials", "testing" );
 
         Class.forName( "org.safehaus.triplesec.guardian.ldap.LdapConnectionDriver" );

Modified: directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicyIntegrationTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicyIntegrationTest.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicyIntegrationTest.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldap/src/test/java/org/safehaus/triplesec/guardian/ldap/LdapApplicationPolicyIntegrationTest.java Sun Jan  7 21:40:11 2007
@@ -83,6 +83,7 @@
         super.setUp();
         Properties props = new Properties();
         props.setProperty( "applicationPrincipalDN", "appName=" + APP_NAME + ",ou=applications,dc=example,dc=com" );
+        props.setProperty( "applicationRDN", "appName=mockContext,appName=" + APP_NAME + ",ou=applications" );
         props.setProperty( "applicationCredentials", "testing" );
 
         Class.forName( "org.safehaus.triplesec.guardian.ldap.LdapConnectionDriver" );
@@ -106,19 +107,19 @@
 
     public void testGetApplicationNameAndProfile()
     {
-        String applicationName = LdapApplicationPolicy.getApplicationName(
-                "appName=testingApp,ou=applications,dc=example,dc=com" );
-        assertEquals( "testingApp", applicationName );
-
-        try
-        {
-            LdapApplicationPolicy.getApplicationName( "notanapp=blahblah" );
-            fail( "should never get here due to an exception" );
-        }
-        catch ( IllegalArgumentException e )
-        {
-
-        }
+//        String applicationName = LdapApplicationPolicy.getApplicationName(
+//                "appName=testingApp,ou=applications,dc=example,dc=com" );
+//        assertEquals( "testingApp", applicationName );
+//
+//        try
+//        {
+//            LdapApplicationPolicy.getApplicationName( "notanapp=blahblah" );
+//            fail( "should never get here due to an exception" );
+//        }
+//        catch ( IllegalArgumentException e )
+//        {
+//
+//        }
 
         Profile p = store.getProfile( "nonexistant" );
         assertNull( p );
@@ -265,7 +266,7 @@
         Hashtable env = new Hashtable();
         env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
         env.put( "java.naming.provider.url", "ldap://localhost:" +  super.getLdapPort()
-            + "/appName=mockApplication,ou=applications,dc=example,dc=com" );
+            + "/appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
         env.put( "java.naming.security.principal", "uid=admin,ou=system" );
         env.put( "java.naming.security.credentials", "secret" );
         env.put( "java.naming.security.authentication", "simple" );

Modified: directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicy.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicy.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicy.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicy.java Sun Jan  7 21:40:11 2007
@@ -29,13 +29,11 @@
 import javax.naming.directory.*;
 import javax.naming.NamingException;
 
-import java.io.File;
 import java.io.InputStream;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.util.*;
 import java.security.Permissions;
-import java.security.Permission;
 
 
 /**
@@ -48,8 +46,6 @@
 {
     /** the logger interface for this class */
     private static Logger log = LoggerFactory.getLogger( LdifApplicationPolicy.class );
-    /** the dn of the application */
-    private final String applicationDn;
     /** the {@link Profile}s loaded from LDIF */
     private Map<String,Profile> profileMap;
     /** map of userNames to sets of profile ids */
@@ -58,6 +54,7 @@
     boolean isClosed = false;
     /** the administrators super profile */
     private Profile adminProfile;
+    private final String applicationDN;
 
 
     /**
@@ -70,18 +67,14 @@
      *   <tr><td>ldifFilePath</td><td>the path to the LDIF file containing the entries to load</td></tr>
      * </table>
      *
-     * @param info additional information needed to load the LDIF file
      * @throws GuardianException if failures are encountered while loading objects from the backing store
      */
-    public LdifApplicationPolicy( InputStream in, Properties info ) throws GuardianException
+    public LdifApplicationPolicy( InputStream in, String applicationRdn, String realmDN ) throws GuardianException
     {
-        this.userProfilesMap = new HashMap<String, Set<String>>();
-        this.profileMap = new HashMap<String, Profile>();
-        this.applicationDn = info.getProperty( "applicationPrincipalDN" );
-        // extract the applicationName from the applicationPrincipalDN
-        this.applicationName = getApplicationName( applicationDn );
-        // extract the path to the LDIF file to load 
-//        this.ldifFile = ldifFile;
+        userProfilesMap = new HashMap<String, Set<String>>();
+        profileMap = new HashMap<String, Profile>();
+        this.applicationRdn = applicationRdn;
+        applicationDN = applicationRdn + "," + realmDN;
         // loads the ldifs as a map of LdapNames to Attributes
         load(in);
         // create the admin profile with all permissions as grants and in all roles
@@ -107,11 +100,12 @@
                 String dn = entry.getDn();
                 entryMap.put( dn, attributes );
 
-                if ( dn.equals( applicationDn ) )
-                {
+//                if ( dn.equals( applicationDn ) )
+//                {
 //                    application = attributes;
-                }
-                else if ( dn.endsWith( applicationDn ) )
+//                }
+//                else
+                if ( dn.endsWith( applicationDN ) )
                 {
                     Attribute oc = attributes.get( "objectClass" );
                     if ( oc.contains( "policyPermission" ) )
@@ -161,19 +155,19 @@
                 Attributes entry = roleMap.get( dn );
                 Role role = getRole(entry);
                 roleSet.add( role );
-                log.debug( "loading role '" + role.getName() + "' for application '" + applicationName + "'" );
+                log.debug( "loading role '" + role.getName() + "' for application '" + applicationRdn + "'" );
             }
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on search to find roles for application " + applicationName;
+            String msg = "Failed on search to find roles for application " + applicationRdn;
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
 
         Role[] roleArray = new Role[roleSet.size()];
         roleArray = roleSet.toArray( roleArray );
-        roles = new Roles( applicationName, roleArray );
+        roles = new Roles( applicationRdn, roleArray );
     }
 
 
@@ -198,20 +192,13 @@
         }
         catch ( NamingException e )
         {
-            String msg = "Failed on load of permissions for application " + applicationName;
+            String msg = "Failed on load of permissions for application " + applicationRdn;
             log.error( msg, e );
             throw new GuardianException( msg, e );
         }
 
     }
 
-
-    public String getApplicationName()
-    {
-        return this.applicationName;
-    }
-
-
     public String getDescription()
     {
         return this.description;
@@ -259,7 +246,7 @@
 
             if ( log.isDebugEnabled() )
             {
-                log.debug( "loaded profile '" + profile.getProfileId() + "' in application '" + applicationName + "'" );
+                log.debug( "loaded profile '" + profile.getProfileId() + "' in application '" + applicationRdn + "'" );
             }
         }
     }

Modified: directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifConnectionDriver.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifConnectionDriver.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifConnectionDriver.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldif/src/main/java/org/safehaus/triplesec/guardian/ldif/LdifConnectionDriver.java Sun Jan  7 21:40:11 2007
@@ -29,7 +29,6 @@
 import java.net.URL;
 import java.util.Properties;
 
-import org.apache.directory.shared.ldap.NotImplementedException;
 import org.safehaus.triplesec.guardian.ApplicationPolicy;
 import org.safehaus.triplesec.guardian.ApplicationPolicyFactory;
 import org.safehaus.triplesec.guardian.ConnectionDriver;
@@ -70,7 +69,7 @@
     {
         if ( info == null )
         {
-            info = new Properties();
+            throw new IllegalArgumentException( "A non-null Properties info object must be provided." );
         }
 
         if ( url == null )
@@ -78,10 +77,16 @@
             throw new IllegalArgumentException( "A non-null url must be provided." );
         }
 
-        String application = info.getProperty( "applicationPrincipalDN" );
-        if ( application == null )
+        String applicationRDN = info.getProperty( "applicationRDN" );
+        if ( applicationRDN == null )
         {
-            throw new IllegalArgumentException( "An applicationPrincipalDN property value must be provided." );
+            throw new IllegalArgumentException( "An applicationRDN property value must be provided." );
+        }
+
+        String realmDN = info.getProperty( "realmDN" );
+        if ( realmDN == null )
+        {
+            throw new IllegalArgumentException( "An realmDN property value must be provided." );
         }
 
         InputStream in;
@@ -112,7 +117,7 @@
             }
         }
         try {
-            return new LdifApplicationPolicy( in, info );
+            return new LdifApplicationPolicy( in, applicationRDN, realmDN );
         } finally {
             try {
                 in.close();

Modified: directory/sandbox/triplesec-jacc2/guardian-ldif/src/test/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/guardian-ldif/src/test/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicyTest.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/guardian-ldif/src/test/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicyTest.java (original)
+++ directory/sandbox/triplesec-jacc2/guardian-ldif/src/test/java/org/safehaus/triplesec/guardian/ldif/LdifApplicationPolicyTest.java Sun Jan  7 21:40:11 2007
@@ -66,6 +66,8 @@
         super.setUp();
         Properties props = new Properties();
         props.setProperty( "applicationPrincipalDN", "appName=mockApplication,ou=applications,dc=example,dc=com" );
+        props.setProperty( "applicationRDN", "appName=mockContext,appName=mockApplication,ou=applications" );
+        props.setProperty( "realmDN", "dc=example,dc=com" );
         Class.forName( "org.safehaus.triplesec.guardian.ldif.LdifConnectionDriver" );
         URL ldifURL = getClass().getClassLoader().getResource("server.ldif");
         String url = ldifURL.toString();
@@ -100,6 +102,7 @@
     }
 
 
+/*
     public void testGetApplicationNameString()
     {
         String applicationName = LdifApplicationPolicy.getApplicationName(
@@ -115,6 +118,7 @@
         {
         }
     }
+*/
 
 
     public void testNonExistantProfile()

Modified: directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.ldif
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.ldif?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.ldif (original)
+++ directory/sandbox/triplesec-jacc2/itest-data/src/main/resources/server.ldif Sun Jan  7 21:40:11 2007
@@ -343,12 +343,17 @@
 appName: mockApplication
 userPassword:: dGVzdGluZw==
 
-dn: ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
+objectClass: top
+objectClass: policyApplication
+appName: mockContext
+
+dn: ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: organizationalUnit
 ou: permissions
 
-dn: permName=mockPerm0,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm0,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 objectClass: javaPermission
@@ -356,81 +361,81 @@
 permJavaClass: org.safehaus.triplesec.guardian.StringPermission
 permJavaName: mockPerm0
 
-dn: permName=mockPerm1,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm1,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm1
 
-dn: permName=mockPerm2,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm2,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm2
 
-dn: permName=mockPerm3,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm3,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm3
 
-dn: permName=mockPerm4,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm4,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm4
 
-dn: permName=mockPerm5,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm5,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm5
 
-dn: permName=mockPerm6,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm6,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm6
 
-dn: permName=mockPerm7,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm7,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm7
 
-dn: permName=mockPerm8,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm8,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm8
 
-dn: permName=mockPerm9,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: permName=mockPerm9,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyPermission
 permName: mockPerm9
 
-dn: ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: organizationalUnit
 ou: roles
 
-dn: roleName=mockRole0,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole0,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: policyRole
 objectClass: top
 roleName: mockRole0
 
-dn: roleName=mockRole1,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole1,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyRole
 grants: mockPerm0
 roleName: mockRole1
 
-dn: roleName=mockRole2,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole2,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyRole
 grants: mockPerm1
 roleName: mockRole2
 
-dn: roleName=mockRole3,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole3,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyRole
 grants: mockPerm3
 grants: mockPerm2
 roleName: mockRole3
 
-dn: roleName=mockRole4,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole4,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyRole
 grants: mockPerm9
@@ -440,7 +445,7 @@
 grants: mockPerm4
 roleName: mockRole4
 
-dn: roleName=mockRole5,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: roleName=mockRole5,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyRole
 grants: mockPerm9
@@ -450,18 +455,18 @@
 denials: mockPerm6
 roleName: mockRole5
 
-dn: ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: organizationalUnit
 ou: profiles
 
-dn: profileId=mockProfile0,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile0,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 user: akarasulu
 profileId: mockProfile0
 
-dn: profileId=mockProfile1,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile1,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 roles: mockRole2
@@ -469,7 +474,7 @@
 user: akarasulu
 profileId: mockProfile1
 
-dn: profileId=mockProfile2,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile2,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 grants: mockPerm0
@@ -477,7 +482,7 @@
 user: akarasulu
 profileId: mockProfile2
 
-dn: profileId=mockProfile3,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile3,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 grants: mockPerm7
@@ -486,7 +491,7 @@
 user: akarasulu
 profileId: mockProfile3
 
-dn: profileId=mockProfile4,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile4,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 denials: mockPerm7
@@ -496,7 +501,7 @@
 user: akarasulu
 profileId: mockProfile4
 
-dn: profileId=mockProfile5,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com
+dn: profileId=mockProfile5,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com
 objectClass: top
 objectClass: policyProfile
 denials: mockPerm7

Modified: directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/SafehausLoginModule.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/SafehausLoginModule.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/SafehausLoginModule.java (original)
+++ directory/sandbox/triplesec-jacc2/jaas/src/main/java/org/safehaus/triplesec/jaas/SafehausLoginModule.java Sun Jan  7 21:40:11 2007
@@ -240,7 +240,7 @@
         {
             throw new AccountDisabledException( "The profile "  + profile.getProfileId() 
                 + " associated with your account for application " 
-                + profile.getApplicationName() + " has been disabled." );
+                + profile.getApplicationRelativeDistinguishedName() + " has been disabled." );
         }
         
         // -------------------------------------------------------------------

Modified: directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java (original)
+++ directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/ApplicationAciManager.java Sun Jan  7 21:40:11 2007
@@ -101,7 +101,7 @@
      * access their subtree.  This method should be invoked immediately after the application entry
      * is created.
      *
-     * @param upDn the user provided DN string for the entry being added
+     * @param appDn the user provided DN string for the entry being added
      * @param appDn the normalized DN for the entry being added
      */
     public void appAdded( LdapDN appDn ) throws NamingException
@@ -121,8 +121,18 @@
     {
         // get the current invocation object's proxy to access it's nexus proxy
         PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
-        removeApplicationAdminGroup( proxy, appDn );
-        removeApplicationSubentry( proxy, appDn );
+        try {
+            removeApplicationAdminGroup( proxy, appDn );
+        } catch (NamingException e) {
+            //ignore, if app was renamed this will happen
+            log.warn("Could not delete ApplicationAdminGroup for app: " + appDn  + ". Perhaps the app was renamed", e);
+        }
+        try {
+            removeApplicationSubentry( proxy, appDn );
+        } catch (NamingException e) {
+            //ignore, if app was renamed this will happen
+            log.warn("Could not delete Application ACI subentry for app: " + appDn  + ". Perhaps the app was renamed", e);
+        }
     }
 
 

Modified: directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java (original)
+++ directory/sandbox/triplesec-jacc2/store/src/main/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptor.java Sun Jan  7 21:40:11 2007
@@ -530,10 +530,11 @@
             name = ( LdapDN ) name.getPrefix( 1 );
         }
 
-        name = ( LdapDN ) name.clone();
-        do
+
+        boolean started = false;
+        boolean ended = false;
+        for (name = ( LdapDN ) name.clone(); name.size() > 1; name.remove( name.size() - 1 ) )
         {
-            name.remove( name.size() - 1 );
             try
             {
                 Attributes entry = next.lookup( name );
@@ -543,9 +544,14 @@
                 {
                     while( e.hasMore() )
                     {
-                        if( "policyApplication".equalsIgnoreCase( String.valueOf( e.next() ) ) )
+                        if( "policyApplication".equalsIgnoreCase( (String) e.next() ) )
                         {
-                            throw new SchemaViolationException( "Non-policy entries cannot reside under policyApplication." );
+                            if (ended) {
+                                throw new SchemaViolationException( "Non-policy entries cannot reside under policyApplication." );
+                            }
+                            started = true;
+                        } else if (started) {
+                            ended = true;
                         }
                     }
                 }
@@ -563,7 +569,6 @@
                 // Ignore silently.
             }
         }
-        while( name.size() > 1 );
     }
     
 

Modified: directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java (original)
+++ directory/sandbox/triplesec-jacc2/store/src/test/java/org/safehaus/triplesec/store/interceptor/PolicyProtectionInterceptorITest.java Sun Jan  7 21:40:11 2007
@@ -167,7 +167,7 @@
         try
         {
             ctx.bind(
-                    "roleName=roleY,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "roleName=roleY,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     null, role);
             Assert.fail();
         }
@@ -188,7 +188,7 @@
         try
         {
             ctx.bind(
-                    "profileId=profileY,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "profileId=profileY,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     null, profile);
             Assert.fail();
         }
@@ -209,7 +209,7 @@
         try
         {
             ctx.bind(
-                    "profileId=profileY,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "profileId=profileY,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     null, profile);
             Assert.fail();
         }
@@ -222,7 +222,7 @@
         try
         {
             ctx.modifyAttributes(
-                    "roleName=mockRole0,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "roleName=mockRole0,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     DirContext.ADD_ATTRIBUTE,
                     new BasicAttributes( "grants", "unknownPerm" ) );
             Assert.fail();
@@ -236,7 +236,7 @@
         try
         {
             ctx.modifyAttributes(
-                    "profileId=mockProfile0,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "profileId=mockProfile0,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     DirContext.ADD_ATTRIBUTE,
                     new BasicAttributes( "grants", "unknownPerm" ) );
             Assert.fail();
@@ -250,7 +250,7 @@
         try
         {
             ctx.modifyAttributes(
-                    "profileId=mockProfile0,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+                    "profileId=mockProfile0,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                     DirContext.ADD_ATTRIBUTE,
                     new BasicAttributes( "roles", "unknownRole" ) );
             Assert.fail();
@@ -286,7 +286,7 @@
 
         try
         {
-            ctx.bind( rn + ", appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
+            ctx.bind( rn + ",appName=mockContext,appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -300,7 +300,7 @@
         try
         {
             ctx.bind( rn + ", " + siblingRN + ", " + parentRN
-                + ", appName=mockApplication, ou=applications, dc=example,dc=com", null, wrongEntry );
+                + ",appName=mockContext,appName=mockApplication, ou=applications, dc=example,dc=com", null, wrongEntry );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -308,12 +308,12 @@
             // OK
         }
 
-        ctx.bind( rn + ", " + parentRN + ", appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
+        ctx.bind( rn + ", " + parentRN + ",appName=mockContext,appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
 
         try
         {
             ctx.bind( rn + ", " + siblingRN + ", " + parentRN
-                + ", appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
+                + ",appName=mockContext,appName=mockApplication, ou=applications, dc=example,dc=com", null, entry );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -329,15 +329,15 @@
         ctx.unbind( "uid=akarasulu, ou=Users, dc=example,dc=com" );
 
         // Test deleting permissions not in use
-        ctx.unbind( "permName=mockPerm8,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.unbind( "permName=mockPerm8,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
 
         // Test deleting roles not in use
-        ctx.unbind( "roleName=mockRole0,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.unbind( "roleName=mockRole0,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
 
         // Test deleting permissions in use
         try
         {
-            ctx.unbind( "permName=mockPerm9,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.unbind( "permName=mockPerm9,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -348,7 +348,7 @@
         // Test deleting roles in use
         try
         {
-            ctx.unbind( "roleName=mockRole1,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.unbind( "roleName=mockRole1,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -357,7 +357,7 @@
         }
 
         // Test deleting profiles (should be deleted without any confirmation)
-        ctx.unbind( "profileId=mockProfile0,ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.unbind( "profileId=mockProfile0,ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
     }
 
 
@@ -394,10 +394,10 @@
         //            // OK
         //        }
         ctx.modifyAttributes(
-            "permName=mockPerm8,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
+            "permName=mockPerm8,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             DirContext.ADD_ATTRIBUTE, new BasicAttributes( "objectclass", "inetOrgPerson" ) );
         ctx.modifyAttributes(
-            "permName=mockPerm8,ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
+            "permName=mockPerm8,ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "objectclass", "inetOrgPerson" ) );
 
         // Test modifications on roles
@@ -421,9 +421,9 @@
         //        {
         //            // OK
         //        }
-        ctx.modifyAttributes( "roleName=mockRole0,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+        ctx.modifyAttributes( "roleName=mockRole0,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             DirContext.ADD_ATTRIBUTE, new BasicAttributes( "objectclass", "inetOrgPerson" ) );
-        ctx.modifyAttributes( "roleName=mockRole0,ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+        ctx.modifyAttributes( "roleName=mockRole0,ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             DirContext.REMOVE_ATTRIBUTE, new BasicAttributes( "objectclass", "inetOrgPerson" ) );
 
         // Test modifications on profiles
@@ -619,8 +619,8 @@
         // Test renaming group entries
         try
         {
-            ctx.rename( "ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "ou=profilesX,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "ou=profilesX,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -629,8 +629,8 @@
         }
         try
         {
-            ctx.rename( "ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "ou=rolesX,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "ou=rolesX,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -639,8 +639,8 @@
         }
         try
         {
-            ctx.rename( "ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "ou=permissionsX,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "ou=permissionsX,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -649,18 +649,18 @@
         }
 
         // Test renaming entries not in use
-        ctx.rename( "permName=mockPerm8, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
-            "permName=mockPermX, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com" );
-        ctx.rename( "roleName=mockRole0, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
-            "roleName=mockRoleX, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com" );
-        ctx.rename( "profileId=mockProfile0, ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
-            "profileId=mockProfileX, ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.rename( "permName=mockPerm8, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+            "permName=mockPermX, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.rename( "roleName=mockRole0, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+            "roleName=mockRoleX, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
+        ctx.rename( "profileId=mockProfile0, ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+            "profileId=mockProfileX, ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
 
         // Test renaming entries in use
         try
         {
-            ctx.rename( "permName=mockPerm9, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "permName=mockPermY, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "permName=mockPerm9, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "permName=mockPermY, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -669,8 +669,8 @@
         }
         try
         {
-            ctx.rename( "roleName=mockRole1, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "roleName=mockRoleY, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "roleName=mockRole1, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "roleName=mockRoleY, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -687,7 +687,7 @@
         // Test renaming group entries
         try
         {
-            ctx.rename( "ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+            ctx.rename( "ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                 "ou=profiles,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
@@ -697,7 +697,7 @@
         }
         try
         {
-            ctx.rename( "ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+            ctx.rename( "ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                 "ou=roles,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
@@ -707,7 +707,7 @@
         }
         try
         {
-            ctx.rename( "ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
+            ctx.rename( "ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
                 "ou=permissions,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
@@ -717,18 +717,18 @@
         }
 
         // Test renaming entries not in use
-        ctx.rename( "permName=mockPerm8, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
+        ctx.rename( "permName=mockPerm8, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             "permName=mockPerm8, ou=applications,dc=example,dc=com" );
-        ctx.rename( "roleName=mockRole0, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
+        ctx.rename( "roleName=mockRole0, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             "roleName=mockRole0, ou=applications,dc=example,dc=com" );
-        ctx.rename( "profileId=mockProfile0, ou=profiles,appName=mockApplication,ou=applications,dc=example,dc=com",
+        ctx.rename( "profileId=mockProfile0, ou=profiles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
             "profileId=mockProfile0, ou=applications,dc=example,dc=com" );
 
         // Test renaming entries in use
         try
         {
-            ctx.rename( "permName=mockPerm9, ou=permissions,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "permName=mockPerm9, appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "permName=mockPerm9, ou=permissions,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "permName=mockPerm9, appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )
@@ -737,8 +737,8 @@
         }
         try
         {
-            ctx.rename( "roleName=mockRole1, ou=roles,appName=mockApplication,ou=applications,dc=example,dc=com",
-                "roleName=mockRole1, appName=mockApplication,ou=applications,dc=example,dc=com" );
+            ctx.rename( "roleName=mockRole1, ou=roles,appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com",
+                "roleName=mockRole1, appName=mockContext,appName=mockApplication,ou=applications,dc=example,dc=com" );
             Assert.fail();
         }
         catch ( SchemaViolationException e )

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ApplicationPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ApplicationPanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ApplicationPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ApplicationPanel.java Sun Jan  7 21:40:11 2007
@@ -419,7 +419,7 @@
     private void setApplicationFields()
     {
         generalPanel.setFields( application );
-        applicationNameTextField.setText( application.getName() );
+        applicationNameTextField.setText( application.getAppRdn() );
         applicationPasswordField.setText( application.getPassword() );
         confirmPasswordField.setText( application.getPassword() );
         descriptionTextArea.setText( application.getDescription() );
@@ -494,7 +494,7 @@
             node.setUserObject( application );
         }
 
-        if ( !application.getName().equals( applicationNameTextField.getText() ) )
+        if ( !application.getAppRdn().equals( applicationNameTextField.getText() ) )
         {
             try
             {

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewApplicationPanel.java Sun Jan  7 21:40:11 2007
@@ -718,7 +718,7 @@
                         return;
                     }
                     Application application = ( Application ) existingAppsTableModel.getValueAt( index, 0 );
-                    applicationNameTextField.setText( "CopyOf" + application.getName() );
+                    applicationNameTextField.setText( "CopyOf" + application.getAppRdn() );
                     descriptionTextArea.setText( application.getDescription() );
                 }
             } );

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewPermissionPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewPermissionPanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewPermissionPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewPermissionPanel.java Sun Jan  7 21:40:11 2007
@@ -359,7 +359,7 @@
         this.node = node;
         existingPermissionsTable.setModel( new ExistingPermissionsTableModel() );
         Application application = ( Application ) ( ( DefaultMutableTreeNode ) node.getParent() ).getUserObject();
-        applicationNameTextField.setText( application.getName() );
+        applicationNameTextField.setText( application.getAppRdn() );
     }
 
 

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewProfilePanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewProfilePanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewProfilePanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewProfilePanel.java Sun Jan  7 21:40:11 2007
@@ -400,7 +400,7 @@
         existingProfilesTable.setModel( new ExistingProfilesTableModel() );
         DefaultMutableTreeNode applicationNode = ( DefaultMutableTreeNode ) node.getParent();
         Application application = ( Application ) ( applicationNode ).getUserObject();
-        applicationNameTextField.setText( application.getName() );
+        applicationNameTextField.setText( application.getAppRdn() );
         
         // -------------------------------------------------------------------
         // clear and load users into the user combo box

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java Sun Jan  7 21:40:11 2007
@@ -365,7 +365,7 @@
         existingRolesTable.setModel( new ExistingRolesTableModel() );
         DefaultMutableTreeNode appNode = ( DefaultMutableTreeNode ) node.getParent();
         Application application = ( Application ) appNode.getUserObject();
-        applicationNameTextField.setText( application.getName() );
+        applicationNameTextField.setText( application.getAppRdn() );
         roleGrantsPanel.populateLists( appNode, Collections.EMPTY_SET );
     }
 

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java?view=diff&rev=493959&r1=493958&r2=493959
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java Sun Jan  7 21:40:11 2007
@@ -406,7 +406,7 @@
     private void setPermissionFields()
     {
         generalPanel.setFields( permission );
-        applicationNameTextField.setText( permission.getApplicationName() );
+        applicationNameTextField.setText( permission.getApplicationRdn() );
         permissionNameTextField.setText( permission.getName() );
         descriptionTextArea.setText( permission.getDescription() );
     }



Mime
View raw message