[jboss-cvs] JBossAS SVN: r62816 - in branches/JBoss_4_0_2_CP: testsuite/imports and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 4 15:40:20 EDT 2007


Author: jiwils
Date: 2007-05-04 15:40:19 -0400 (Fri, 04 May 2007)
New Revision: 62816

Added:
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanA.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanB.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanC.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLogin.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLoginHome.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleEJBUnitTestCase.java
   branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleUnitTestCase.java
   branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/
   branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/ejb-jar.xml
   branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jaas-service.xml
   branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jboss.xml
Modified:
   branches/JBoss_4_0_2_CP/server/src/main/org/jboss/security/SecurityAssociation.java
   branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml
Log:
Test Cases for ASPATCH-207.

Modified: branches/JBoss_4_0_2_CP/server/src/main/org/jboss/security/SecurityAssociation.java
===================================================================
--- branches/JBoss_4_0_2_CP/server/src/main/org/jboss/security/SecurityAssociation.java	2007-05-04 17:43:49 UTC (rev 62815)
+++ branches/JBoss_4_0_2_CP/server/src/main/org/jboss/security/SecurityAssociation.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -497,6 +497,23 @@
    }
 
    /**
+    * Look at the current thread of control's authenticated identity on the top
+    * of the stack.
+    * When run under a security manager this requires the
+    * RuntimePermission("org.jboss.security.SecurityAssociation.getPrincipalInfo")
+    * permission.
+    * @return the SubjectContext pushed previously by a pushSubjectContext call
+    */
+   public static SubjectContext peekSubjectContext()
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm != null)
+         sm.checkPermission(getPrincipalInfoPermission);
+
+      return threadSubjectStacks.peek();
+   }
+
+   /**
     * Clear all principal information. If a security manager is present, then
     * this method calls the security manager's <code>checkPermission</code>
     * method with a <code> RuntimePermission("org.jboss.security.SecurityAssociation.setPrincipalInfo")

Modified: branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml	2007-05-04 17:43:49 UTC (rev 62815)
+++ branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml	2007-05-04 19:40:19 UTC (rev 62816)
@@ -4078,8 +4078,22 @@
           <include name="org/jboss/test/security/servlets/ConstraintsServlet.class"/>
         </classes>
      </war>
-  </target>
 
+     <!-- build client-login-tests.jar -->
+     <jar destfile="${build.lib}/client-login-tests.jar">
+         <fileset dir="${build.classes}">
+             <include name="org/jboss/test/security/clientlogin/**"/>
+         </fileset>
+         <fileset dir="${build.resources}/security/client-login">
+             <include name="jaas-service.xml"/>
+         </fileset>
+         <metainf dir="${build.resources}/security/client-login">
+             <include name="ejb-jar.xml" />
+             <include name="jboss.xml" />
+         </metainf>
+     </jar>
+ </target>
+
   <!-- testbean test -->
   <target name="_jars-testbean">
     <mkdir dir="${build.lib}"/>

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanA.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanA.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanA.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,116 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.security.clientlogin;
+
+import java.security.Principal;
+import java.rmi.RemoteException;
+import javax.ejb.SessionContext;
+import javax.ejb.SessionBean;
+import javax.security.auth.login.LoginContext;
+import javax.naming.InitialContext;
+
+import org.jboss.security.auth.callback.UsernamePasswordHandler;
+
+/**
+ An IClientLogin session bean that calls a BeanB with changes in the
+ caller indentity using ClientLogin module.
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41293 $
+ */
+public class BeanA implements SessionBean
+{
+   private SessionContext context;
+
+   public void ejbCreate()
+   {
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove()
+   {
+   }
+
+   public void setSessionContext(SessionContext context)
+   {
+      this.context = context;
+   }
+
+   public Principal callBeanAsClientLoginUser() throws RemoteException
+   {
+      Principal caller = context.getCallerPrincipal();
+      String inputName = caller.getName();
+      try
+      {
+         UsernamePasswordHandler handler = new UsernamePasswordHandler("clientLoginA1", "A1");
+         LoginContext lc = new LoginContext("client-login", handler);
+         lc.login();
+         InitialContext ctx = new InitialContext();
+         IClientLoginHome home = (IClientLoginHome) ctx.lookup("java:comp/env/TargetBean");
+         IClientLogin bean = home.create();
+         Principal callerB1 = bean.callBeanAsClientLoginUser();
+         if( callerB1.getName().equals("clientLoginA1") == false )
+            throw new RemoteException("callBeanAsClientLoginUser#1 != clientLoginA1");
+         lc.logout();
+
+         handler = new UsernamePasswordHandler("clientLoginA2", "A2");
+         lc = new LoginContext("client-login", handler);
+         lc.login();
+         Principal callerB2 = bean.callBeanAsClientLoginUser();
+         if( callerB2.getName().equals("clientLoginA2") == false )
+            throw new RemoteException("callBeanAsClientLoginUser#2 != clientLoginA2");
+         lc.logout();
+
+         // Make sure the caller principal is the same
+         String inputName2 = context.getCallerPrincipal().getName();
+         if( inputName.equals(inputName2) == false )
+            throw new RemoteException("CallerPrincipal changed after logout");
+      }
+      catch(Exception e)
+      {
+         if(e instanceof RemoteException )
+            throw (RemoteException) e;
+         throw new RemoteException("callBeanAsClientLoginUser", e);
+      }
+      return caller;
+   }
+   public Principal callTarget() throws RemoteException
+   {
+      return null;
+   }
+
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanB.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanB.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanB.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,116 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.security.clientlogin;
+
+import java.security.Principal;
+import java.rmi.RemoteException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.security.auth.login.LoginContext;
+import javax.naming.InitialContext;
+
+import org.jboss.security.auth.callback.UsernamePasswordHandler;
+
+/**
+ An IClientLogin session bean that calls a BeanC with changes in the
+ caller indentity using ClientLogin module.
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41293 $
+ */
+public class BeanB implements SessionBean
+{
+   private SessionContext context;
+
+   public void ejbCreate()
+   {
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove()
+   {
+   }
+
+   public void setSessionContext(SessionContext context)
+   {
+      this.context = context;
+   }
+
+   public Principal callBeanAsClientLoginUser() throws RemoteException
+   {
+      Principal caller = context.getCallerPrincipal();
+      String inputName = caller.getName();
+      try
+      {
+         UsernamePasswordHandler handler = new UsernamePasswordHandler("clientLoginB1", "B1");
+         LoginContext lc = new LoginContext("client-login", handler);
+         lc.login();
+         InitialContext ctx = new InitialContext();
+         IClientLoginHome home = (IClientLoginHome) ctx.lookup("java:comp/env/TargetBean");
+         IClientLogin bean = home.create();
+         Principal callerB1 = bean.callTarget();
+         if( callerB1.getName().equals("clientLoginB1") == false )
+            throw new RemoteException("callBeanAsClientLoginUser#1 != clientLoginB1");
+         lc.logout();
+
+         handler = new UsernamePasswordHandler("clientLoginB2", "B2");
+         lc = new LoginContext("client-login", handler);
+         lc.login();
+         Principal callerB2 = bean.callTarget();
+         if( callerB2.getName().equals("clientLoginB2") == false )
+            throw new RemoteException("callBeanAsClientLoginUser#2 != clientLoginB2");
+         lc.logout();
+
+         // Make sure the caller principal is the same
+         String inputName2 = context.getCallerPrincipal().getName();
+         if( inputName.equals(inputName2) == false )
+            throw new RemoteException("CallerPrincipal changed after logout");
+      }
+      catch(Exception e)
+      {
+         if(e instanceof RemoteException )
+            throw (RemoteException) e;
+         throw new RemoteException("callBeanAsClientLoginUser", e);
+      }
+      return caller;
+   }
+   public Principal callTarget() throws RemoteException
+   {
+      return null;
+   }
+
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanC.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanC.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/BeanC.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,78 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test.security.clientlogin;
+
+import java.security.Principal;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ An IClientLogin session bean that is the target of BeanB
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41293 $
+ */
+public class BeanC implements SessionBean
+{
+   private SessionContext context;
+
+   public void ejbCreate()
+   {
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove()
+   {
+   }
+
+   public void setSessionContext(SessionContext context)
+   {
+      this.context = context;
+   }
+
+   public Principal callBeanAsClientLoginUser()
+   {
+      Principal caller = context.getCallerPrincipal();
+      return caller;
+   }
+   public Principal callTarget()
+   {
+      Principal caller = context.getCallerPrincipal();
+      return caller;
+   }
+
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLogin.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLogin.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLogin.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,46 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.security.clientlogin;
+
+import java.security.Principal;
+import java.rmi.RemoteException;
+import javax.ejb.EJBObject;
+
+/**
+ Remote interface for testing the interaction of the ClientLoginModule
+ with the declarative security context.
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41293 $
+ */
+public interface IClientLogin extends EJBObject
+{
+   public Principal callBeanAsClientLoginUser() throws RemoteException;
+   public Principal callTarget() throws RemoteException;
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLoginHome.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLoginHome.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/clientlogin/IClientLoginHome.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,44 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.security.clientlogin;
+
+import java.rmi.RemoteException;
+import javax.ejb.EJBHome;
+import javax.ejb.CreateException;
+
+/**
+ EJBHome for IClientLogin
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41293 $
+ */
+public interface IClientLoginHome extends EJBHome
+{
+    public IClientLogin create() throws RemoteException, CreateException;
+}
+

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleEJBUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleEJBUnitTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleEJBUnitTestCase.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,85 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.security.test;
+
+import java.util.Properties;
+import java.security.Principal;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.security.clientlogin.IClientLoginHome;
+import org.jboss.test.security.clientlogin.IClientLogin;
+import junit.framework.Test;
+
+/** Tests of the interaction between the ClientLoginModule and the
+ SecurityAssocation context for secured ejbs
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41294 $
+ */
+public class ClientLoginModuleEJBUnitTestCase
+   extends JBossTestCase
+{
+   public ClientLoginModuleEJBUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    Call BeanA using jduke/theduke
+    +-- call BeanB switching idenity using ClientLoginModule
+    +---- call BeanC switching idenity using ClientLoginModule
+    validing the expected caller principal with different ejb method permissions
+    @throws Exception
+    */
+   public void testClientLoginModule() throws Exception
+   {
+      log.debug("+++ testPublicMethod()");
+      Properties env = new Properties();
+      env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+         "org.jboss.security.jndi.JndiLoginInitialContextFactory");
+      env.setProperty(Context.SECURITY_PRINCIPAL, "jduke");
+      env.setProperty(Context.SECURITY_CREDENTIALS, "theduke");
+      InitialContext ctx = new InitialContext(env);
+      Object obj = ctx.lookup("client-login-tests/BeanA");
+      obj = PortableRemoteObject.narrow(obj, IClientLoginHome.class);
+      IClientLoginHome home = (IClientLoginHome) obj;
+      log.debug("Found IClientLoginHome");
+      IClientLogin bean = home.create();
+      log.debug("Created IClientLogin");
+
+      Principal user = bean.callBeanAsClientLoginUser();
+      assertTrue("callBeanAsClientLoginUser value == jduke",
+         user.getName().equals("jduke"));
+      bean.remove();
+   }
+
+   public static Test suite() throws Exception
+   {
+      return JBossTestCase.getDeploySetup(ClientLoginModuleEJBUnitTestCase.class,
+         "client-login-tests.jar");
+   }
+
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleUnitTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/security/test/ClientLoginModuleUnitTestCase.java	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,440 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.security.test;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Arrays;
+import java.lang.reflect.Method;
+
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.Subject;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.auth.callback.UsernamePasswordHandler;
+
+/**
+ ClientLoginModuleUnitTestCase/SecurityAssociation interaction tests
+ 
+ @author Scott.Stark at jboss.org
+ @version $Revision: 41290 $
+*/
+public class ClientLoginModuleUnitTestCase
+   extends TestCase
+{
+   static TestConfig jaasConfig = new TestConfig();
+
+   static class TestConfig extends Configuration
+   {
+      public void refresh()
+      {
+      }
+
+      public AppConfigurationEntry[] getAppConfigurationEntry(String name)
+      {
+         AppConfigurationEntry[] entry = null;
+         try
+         {
+            Class[] parameterTypes = {};
+            Method m = getClass().getDeclaredMethod(name, parameterTypes);
+            Object[] args = {};
+            entry = (AppConfigurationEntry[]) m.invoke(this, args);
+         }
+         catch(Exception e)
+         {
+         }
+         return entry;
+      }
+      AppConfigurationEntry[] testSingleThreaded()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "false");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      AppConfigurationEntry[] testSingleThreadedRestoreIdentity()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "false");
+         options.put("restore-login-identity", "true");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      AppConfigurationEntry[] testSingleThreadedRestoreStack()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "false");
+         options.put("restore-login-identity", "true");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      AppConfigurationEntry[] testMultiThreaded()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "true");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      AppConfigurationEntry[] testMultiThreadedRestoreIdentity()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "true");
+         options.put("restore-login-identity", "true");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      AppConfigurationEntry[] testMultiThreadedRestoreStack()
+      {
+         String name = "org.jboss.security.ClientLoginModule";
+         HashMap options = new HashMap();
+         options.put("multi-threaded", "true");
+         options.put("restore-login-identity", "true");
+         AppConfigurationEntry ace = new AppConfigurationEntry(name,
+         AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+         AppConfigurationEntry[] entry = {ace};
+         return entry;
+      }
+      
+   }
+
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreaded"));
+      suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreIdentity"));
+      suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreStack"));
+      suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreaded"));
+      suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreIdentity"));
+      suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreStack"));
+      return suite;
+   }
+
+   public ClientLoginModuleUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected void setUp() throws Exception
+   {
+      Configuration.setConfiguration(jaasConfig);
+   }
+   protected void tearDown()
+   {
+   }
+
+   public void testSingleThreaded() throws Exception
+   {
+      System.out.println("+++ testSingleThreaded");
+      UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
+         "theduke");
+      LoginContext lc = new LoginContext("testSingleThreaded", handler);
+      lc.login();
+      Subject subject = lc.getSubject();
+      System.out.println("LC.Subject: "+subject);
+      Principal theduke = new SimplePrincipal("jduke");
+      assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
+      Principal saPrincipal = SecurityAssociation.getPrincipal();
+      assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
+      char[] password = (char[]) SecurityAssociation.getCredential();
+      assertTrue("password == theduke",
+         Arrays.equals(password, "theduke".toCharArray()));
+   }
+
+   public void testSingleThreadedRestoreIdentity() throws Exception
+   {
+      System.out.println("+++ testSingleThreadedRestoreIdentity");
+
+      Principal jduke1 = new SimplePrincipal("jduke1");
+      SecurityAssociation.setPrincipal(jduke1);
+      SecurityAssociation.setCredential("theduke1");
+
+      UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
+         "theduke2");
+      LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+      lc.login();
+      Subject subject = lc.getSubject();
+      System.out.println("LC.Subject: "+subject);
+      
+      Principal jduke2 = new SimplePrincipal("jduke2");
+      assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
+      Principal saPrincipal = SecurityAssociation.getPrincipal();
+      assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
+      char[] password = (char[]) SecurityAssociation.getCredential();
+      assertTrue("password == theduke2",
+         Arrays.equals(password, "theduke2".toCharArray()));
+
+      lc.logout();
+      // Validate restored state
+      saPrincipal = SecurityAssociation.getPrincipal();
+      assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
+      String theduke1 = (String) SecurityAssociation.getCredential();
+      assertTrue("password == theduke1", theduke1.equals("theduke1"));
+      
+   }
+
+   public void testSingleThreadedRestoreStack() throws Exception
+   {
+      System.out.println("+++ testSingleThreadedRestoreStack");
+
+      Principal jduke1 = new SimplePrincipal("jduke1");
+      Subject subject1 = new Subject();
+      SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
+
+      Principal jduke2 = new SimplePrincipal("jduke2");
+      Subject subject2 = new Subject();
+      SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
+
+      UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
+         "theduke3");
+      LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+      lc.login();
+      Subject subject = lc.getSubject();
+      System.out.println("LC.Subject: "+subject);
+      
+      Principal jduke3 = new SimplePrincipal("jduke3");
+      assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
+      Principal saPrincipal = SecurityAssociation.getPrincipal();
+      assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
+      char[] password = (char[]) SecurityAssociation.getCredential();
+      assertTrue("password == theduke3",
+         Arrays.equals(password, "theduke3".toCharArray()));
+      SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
+      System.out.println(sc3);
+      assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
+      char[] theduke3 = (char[]) sc3.getCredential();
+      assertTrue("password == theduke3",
+         Arrays.equals(theduke3, "theduke3".toCharArray()));
+
+      lc.logout();
+
+      // Validate restored state
+      SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
+      System.out.println(sc2);
+      assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
+      String theduke2 = (String) sc2.getCredential();
+      assertTrue("password == theduke2", theduke2.equals("theduke2"));
+
+      SecurityAssociation.popSubjectContext();
+      SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
+      System.out.println(sc1);
+      assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
+      String theduke1 = (String) sc1.getCredential();
+      assertTrue("password == theduke1", theduke1.equals("theduke1"));
+   }
+
+   public void testMultiThreaded() throws Exception
+   {
+      TestMultiThreaded r0 = new TestMultiThreaded();
+      Thread t0 = new Thread(r0, "testMultiThreaded#0");
+      t0.start();
+      TestMultiThreaded r1 = new TestMultiThreaded();
+      Thread t1 = new Thread(r1, "testMultiThreaded#1");
+      t1.start();
+
+      t0.join();
+      assertTrue(r0.failure == null);
+      t1.join();
+      assertTrue(r1.failure == null);
+   }
+   static class TestMultiThreaded implements Runnable
+   {
+      Exception failure;
+      public void run()
+      {
+         try
+         {
+            System.out.println("+++ testMultiThreadedRunnable");
+            UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
+               "theduke");
+            LoginContext lc = new LoginContext("testSingleThreaded", handler);
+            lc.login();
+            Subject subject = lc.getSubject();
+            System.out.println("LC.Subject: "+subject);
+            Principal theduke = new SimplePrincipal("jduke");
+            assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
+            Principal saPrincipal = SecurityAssociation.getPrincipal();
+            assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
+            char[] password = (char[]) SecurityAssociation.getCredential();
+            assertTrue("password == theduke",
+               Arrays.equals(password, "theduke".toCharArray()));
+         }
+         catch(Exception e)
+         {
+            failure = e;
+         }
+      }
+   }
+
+   public void testMultiThreadedRestoreIdentity() throws Exception
+   {
+      TestMultiThreadedRestoreIdentity r0 = new TestMultiThreadedRestoreIdentity();
+      Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
+      t0.start();
+      TestMultiThreadedRestoreIdentity r1 = new TestMultiThreadedRestoreIdentity();
+      Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
+      t1.start();
+
+      t0.join();
+      assertTrue(r0.failure == null);
+      t1.join();
+      assertTrue(r1.failure == null);
+   }
+   static class TestMultiThreadedRestoreIdentity implements Runnable
+   {
+      Exception failure;
+      public void run()
+      {
+         try
+         {
+            System.out.println("+++ testMultiThreadedRestoreIdentity");
+      
+            Principal jduke1 = new SimplePrincipal("jduke1");
+            SecurityAssociation.setPrincipal(jduke1);
+            SecurityAssociation.setCredential("theduke1");
+      
+            UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
+               "theduke2");
+            LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+            lc.login();
+            Subject subject = lc.getSubject();
+            System.out.println("LC.Subject: "+subject);
+            
+            Principal jduke2 = new SimplePrincipal("jduke2");
+            assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
+            Principal saPrincipal = SecurityAssociation.getPrincipal();
+            assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
+            char[] password = (char[]) SecurityAssociation.getCredential();
+            assertTrue("password == theduke2",
+               Arrays.equals(password, "theduke2".toCharArray()));
+      
+            lc.logout();
+            // Validate restored state
+            saPrincipal = SecurityAssociation.getPrincipal();
+            assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
+            String theduke1 = (String) SecurityAssociation.getCredential();
+            assertTrue("password == theduke1", theduke1.equals("theduke1"));
+      
+         }
+         catch(Exception e)
+         {
+            failure = e;
+         }
+      }
+   }
+
+   public void testMultiThreadedRestoreStack() throws Exception
+   {
+      TestMultiThreadedRestoreStack r0 = new TestMultiThreadedRestoreStack();
+      Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
+      t0.start();
+      TestMultiThreadedRestoreStack r1 = new TestMultiThreadedRestoreStack();
+      Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
+      t1.start();
+
+      t0.join();
+      assertTrue(r0.failure == null);
+      t1.join();
+      assertTrue(r1.failure == null);
+   }
+   static class TestMultiThreadedRestoreStack implements Runnable
+   {
+      Exception failure;
+      public void run()
+      {
+         try
+         {
+            System.out.println("+++ testMultThreadedRestoreStack");
+
+            Principal jduke1 = new SimplePrincipal("jduke1");
+            Subject subject1 = new Subject();
+            SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
+
+            Principal jduke2 = new SimplePrincipal("jduke2");
+            Subject subject2 = new Subject();
+            SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
+
+            UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
+               "theduke3");
+            LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+            lc.login();
+            Subject subject = lc.getSubject();
+            System.out.println("LC.Subject: "+subject);
+      
+            Principal jduke3 = new SimplePrincipal("jduke3");
+            assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
+            Principal saPrincipal = SecurityAssociation.getPrincipal();
+            assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
+            char[] password = (char[]) SecurityAssociation.getCredential();
+            assertTrue("password == theduke3",
+               Arrays.equals(password, "theduke3".toCharArray()));
+            SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
+            System.out.println(sc3);
+            assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
+            char[] theduke3 = (char[]) sc3.getCredential();
+            assertTrue("password == theduke3",
+               Arrays.equals(theduke3, "theduke3".toCharArray()));
+
+            lc.logout();
+
+            // Validate restored state
+            SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
+            System.out.println(sc2);
+            assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
+            String theduke2 = (String) sc2.getCredential();
+            assertTrue("password == theduke2", theduke2.equals("theduke2"));
+
+            SecurityAssociation.popSubjectContext();
+            SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
+            System.out.println(sc1);
+            assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
+            String theduke1 = (String) sc1.getCredential();
+            assertTrue("password == theduke1", theduke1.equals("theduke1"));
+         }
+         catch(Exception e)
+         {
+            failure = e;
+         }
+      }
+   }
+
+}

Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/ejb-jar.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/ejb-jar.xml	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/ejb-jar.xml	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" id="ejb-jar_ID"
+         version="2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
+   <enterprise-beans>
+      <session id="BeanA">
+         <ejb-name>BeanA</ejb-name>
+         <home>org.jboss.test.security.clientlogin.IClientLoginHome</home>
+         <remote>org.jboss.test.security.clientlogin.IClientLogin</remote>
+         <ejb-class>org.jboss.test.security.clientlogin.BeanA</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>TargetBean</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.clientlogin.IClientLoginHome</home>
+            <remote>org.jboss.test.security.clientlogin.IClientLogin</remote>
+            <ejb-link>BeanB</ejb-link>
+         </ejb-ref>
+      </session>
+
+      <session id="BeanB">
+         <ejb-name>BeanB</ejb-name>
+         <home>org.jboss.test.security.clientlogin.IClientLoginHome</home>
+         <remote>org.jboss.test.security.clientlogin.IClientLogin</remote>
+         <ejb-class>org.jboss.test.security.clientlogin.BeanB</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>TargetBean</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <home>org.jboss.test.security.clientlogin.IClientLoginHome</home>
+            <remote>org.jboss.test.security.clientlogin.IClientLogin</remote>
+            <ejb-link>BeanC</ejb-link>
+         </ejb-ref>
+      </session>
+
+      <session id="BeanC">
+         <ejb-name>BeanC</ejb-name>
+         <home>org.jboss.test.security.clientlogin.IClientLoginHome</home>
+         <remote>org.jboss.test.security.clientlogin.IClientLogin</remote>
+         <ejb-class>org.jboss.test.security.clientlogin.BeanC</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+   </enterprise-beans>
+
+   <assembly-descriptor>
+      <method-permission id="callerA">
+         <role-name>CanCallA</role-name>
+         <method>
+            <ejb-name>BeanA</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission id="callerB">
+         <role-name>CanCallB</role-name>
+         <method>
+            <ejb-name>BeanB</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+      <method-permission id="callerC">
+         <role-name>CanCallC</role-name>
+         <method>
+            <ejb-name>BeanC</ejb-name>
+            <method-name>*</method-name>
+         </method>
+      </method-permission>
+   </assembly-descriptor>
+</ejb-jar>

Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jaas-service.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jaas-service.xml	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jaas-service.xml	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+   <!-- The custom JAAS login configuration that installs 
+       a Configuration capable of dynamically updating the
+       config settings
+   -->
+   <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
+      name="jboss.security.tests:service=LoginConfig,test=SubjectContext">
+      <attribute name="PolicyConfig" serialDataType="jbxb">
+         <policy
+            xsi:schemaLocation="urn:jboss:security-config:4.1 resource:security-config_4_1.xsd"
+            xmlns="urn:jboss:security-config:4.1"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            >
+            <application-policy name="client-login-tests">
+               <authentication>
+                  <login-module code="org.jboss.security.auth.spi.XMLLoginModule"
+                     flag="required">
+                     <module-option name="userInfo">
+                        <users
+                           xsi:schemaLocation="urn:jboss:user-roles:1.0 resource:user-roles_1_0.xsd"
+                           xmlns="urn:jboss:user-roles:1.0">
+                           <user name="jduke" password="theduke">
+                              <role name="CanCallA"/>
+                           </user>
+                           <user name="clientLoginA1" password="A1">
+                              <role name="CanCallB"/>
+                           </user>
+                           <user name="clientLoginA2" password="A2">
+                              <role name="CanCallB"/>
+                           </user>
+                           <user name="clientLoginB1" password="B1">
+                              <role name="CanCallC"/>
+                           </user>
+                           <user name="clientLoginB2" password="B2">
+                              <role name="CanCallC"/>
+                           </user>
+                        </users>
+                     </module-option>
+                     <module-option name="unauthenticatedIdentity">guest</module-option>
+                  </login-module>
+               </authentication>
+            </application-policy>
+         </policy>         
+      </attribute>
+      <depends optional-attribute-name="LoginConfigService">
+         jboss.security:service=XMLLoginConfig
+      </depends>
+      <depends optional-attribute-name="SecurityManagerService">
+         jboss.security:service=JaasSecurityManager
+      </depends>
+   </mbean>
+
+</server>

Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jboss.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jboss.xml	                        (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/security/client-login/jboss.xml	2007-05-04 19:40:19 UTC (rev 62816)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+      "-//JBoss//DTD JBOSS 4.0//EN"
+      "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+<jboss>
+   <security-domain>java:/jaas/client-login-tests</security-domain>
+   <enterprise-beans>
+      <session>
+         <ejb-name>BeanA</ejb-name>
+         <jndi-name>client-login-tests/BeanA</jndi-name>
+      </session>
+      <session>
+         <ejb-name>BeanB</ejb-name>
+         <jndi-name>client-login-tests/BeanB</jndi-name>
+      </session>
+      <session>
+         <ejb-name>BeanC</ejb-name>
+         <jndi-name>client-login-tests/BeanC</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>




More information about the jboss-cvs-commits mailing list