[jboss-cvs] JBossAS SVN: r78986 - in branches/JBPAPP_4_2_0_GA_CP: server/src/main/org/jboss/ejb/plugins and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 1 05:47:46 EDT 2008
Author: darran.lofthouse at jboss.com
Date: 2008-10-01 05:47:46 -0400 (Wed, 01 Oct 2008)
New Revision: 78986
Added:
branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml
Removed:
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml
Modified:
branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml
branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml
Log:
[JBPAPP-1226] Incorrect CallerPrincipal used for ejbCreate method of EJB2.1 Stateful Session Bean.
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -957,6 +957,7 @@
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.ejb.plugins.StatefulSessionSecurityInterceptor</interceptor>
</container-interceptors>
<instance-cache>org.jboss.ejb.plugins.StatefulSessionInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager</persistence-manager>
@@ -997,6 +998,7 @@
<interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.ejb.plugins.StatefulSessionSecurityInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.StatefulHASessionSynchronisationInterceptor</interceptor>
</container-interceptors>
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -133,7 +133,9 @@
ctx.lock();
// Set the current security information
- ctx.setPrincipal(mi.getPrincipal());
+ /**
+ * JBAS-3976: Setting principal on the context has been moved to a separate interceptor
+ */
AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);
@@ -318,8 +320,9 @@
lock.releaseSync();
}
- // Set the current security information
- ctx.setPrincipal(mi.getPrincipal());
+ /**
+ * JBAS-3976: Setting principal on the context has been moved to a separate interceptor
+ */
if (ejbTimeout.equals(mi.getMethod()))
AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_TIMEOUT);
Copied: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java (from rev 78985, branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejb.plugins;
+
+import javax.ejb.EJBObject;
+
+import org.jboss.ejb.Container;
+import org.jboss.ejb.EnterpriseContext;
+import org.jboss.ejb.StatefulSessionContainer;
+import org.jboss.invocation.Invocation;
+import org.jboss.logging.Logger;
+
+//$Id$
+
+/**
+ * Interceptor that handles security aspects after the security checks
+ * have been made. Example: setting the principal on the EnterpriseContext
+ *
+ * This interceptor is needed because the security interceptor happens after
+ * the instance interceptor in the case of SFSB due to the reason that
+ * security exceptions need to invalidate the session.
+ *
+ * Note: This interceptor has to follow the SFSB instance interceptor in the
+ * call path as it obtains the enterprise context from the invocation
+ *
+ * JIRA Reference: JBAS-3976
+ *
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Jan 10, 2007
+ * @version $Revision$
+ */
+public class StatefulSessionSecurityInterceptor extends AbstractInterceptor
+{
+ /** Instance logger. */
+ protected Logger log = Logger.getLogger(this.getClass());
+
+ protected StatefulSessionContainer container;
+
+ //Public -------------------------------------------------------
+
+ public void setContainer(Container container)
+ {
+ this.container = (StatefulSessionContainer) container;
+ }
+
+ public Container getContainer()
+ {
+ return container;
+ }
+
+ public Object invoke(Invocation mi) throws Exception
+ {
+ EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext();
+ if (ctx == null)
+ throw new IllegalStateException("EJBContext is null");
+
+ //Set the current security information
+ ctx.setPrincipal(mi.getPrincipal());
+
+ // Invoke through interceptors
+ return getNext().invoke(mi);
+ }
+
+ public Object invokeHome(Invocation mi) throws Exception
+ {
+ //Invocation on the handle, we don't need a bean instance
+ if (EJBObject.class.getMethod("getEJBHome", new Class[0]).equals(mi.getMethod()))
+ return getNext().invokeHome(mi);
+
+ EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext();
+ if (ctx == null)
+ throw new IllegalStateException("EJBContext is null");
+ //Set the current security information
+ ctx.setPrincipal(mi.getPrincipal());
+
+ // Invoke through interceptors
+ return getNext().invokeHome(mi);
+ }
+}
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -23,7 +23,7 @@
name="org/jboss/test/security/ejb/StatefulSessionBean.*"/>
<include name="org/jboss/test/security/interfaces/**"/>
</fileset>
- </jar>
+ </jar>
<!-- subject-context.ear/{subject-context.jar,subject-context.war} -->
<jar destfile="${build.lib}/subject-context.jar">
@@ -257,6 +257,21 @@
</zipfileset>
</ear>
+ <!-- security-jbas6006.jar -->
+ <jar destfile="${build.lib}/security-jbas6006.jar">
+ <metainf dir="${build.resources}/security/jbas6006">
+ <include name="ejb-jar.xml"/>
+ <include name="jboss.xml"/>
+ <include name="login-config.xml"/>
+ </metainf>
+ <fileset dir="${build.resources}/security/jbas6006">
+ <include name="login-service.xml"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/security/ejb/jbas6006/StatefulSession*.*"/>
+ </fileset>
+ </jar>
+
<!-- web-constraints.war -->
<war warfile="${build.lib}/web-constraints.war"
webxml="${build.resources}/security/web-constraints/web.xml">
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006 (from rev 78985, branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006)
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,105 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.rmi.PortableRemoteObject;
-import javax.security.auth.login.LoginContext;
-
-import junit.framework.Test;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.util.AppCallbackHandler;
-
-/**
- * [JBAS-6006] Wrong CallerPrincipal provided to ejbCreate method
- * in Stateful session bean.
- *
- * @author darran.lofthouse at jboss.com
- * @since 30th September 2008
- */
-public class JBAS6006TestCase extends JBossTestCase
-{
-
- private LoginContext lc;
-
- public JBAS6006TestCase(String name)
- {
- super(name);
- }
-
- public void testSecuredCalls() throws Exception
- {
- SecurityAssociation.clear();
-
- StatefulSessionHome home = getHome();
- StatefulSessionRemote remote = home.create("guest");
- remote.testCaller("guest");
- remote.remove();
-
-
- login("jduke", "theduke".toCharArray());
- home = getHome();
- remote = home.create("jduke");
- remote.testCaller("jduke");
- remote.remove();
- logout();
- }
-
- private void login(String username, char[] password) throws Exception
- {
- AppCallbackHandler handler = new AppCallbackHandler(username, password);
- lc = new LoginContext("other", handler);
- lc.login();
- log.debug("Created LoginContext, subject=" + lc.getSubject());
- }
-
- private void logout() throws Exception
- {
- if (lc != null)
- {
- lc.logout();
- }
- }
-
- private StatefulSessionHome getHome() throws Exception
- {
- Properties env = new Properties();
- env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
-
- InitialContext ctx = new InitialContext(env);
-
- Object homeObj = ctx.lookup("jbas6006.StatefulSessionBean");
- StatefulSessionHome home = (StatefulSessionHome) PortableRemoteObject.narrow(homeObj, StatefulSessionHome.class);
-
- return home;
- }
-
- public static Test suite() throws Exception
- {
- return JBossTestCase.getDeploySetup(JBAS6006TestCase.class, "security-jbas6006.jar");
- }
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java (from rev 78985, branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/JBAS6006TestCase.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,105 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+import javax.security.auth.login.LoginContext;
+
+import junit.framework.Test;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.AppCallbackHandler;
+
+/**
+ * [JBAS-6006] Wrong CallerPrincipal provided to ejbCreate method
+ * in Stateful session bean.
+ *
+ * @author darran.lofthouse at jboss.com
+ * @since 30th September 2008
+ */
+public class JBAS6006TestCase extends JBossTestCase
+{
+
+ private LoginContext lc;
+
+ public JBAS6006TestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testSecuredCalls() throws Exception
+ {
+ SecurityAssociation.clear();
+
+ StatefulSessionHome home = getHome();
+ StatefulSessionRemote remote = home.create("guest");
+ remote.testCaller("guest");
+ remote.remove();
+
+
+ login("jduke", "theduke".toCharArray());
+ home = getHome();
+ remote = home.create("jduke");
+ remote.testCaller("jduke");
+ remote.remove();
+ logout();
+ }
+
+ private void login(String username, char[] password) throws Exception
+ {
+ AppCallbackHandler handler = new AppCallbackHandler(username, password);
+ lc = new LoginContext("other", handler);
+ lc.login();
+ log.debug("Created LoginContext, subject=" + lc.getSubject());
+ }
+
+ private void logout() throws Exception
+ {
+ if (lc != null)
+ {
+ lc.logout();
+ }
+ }
+
+ private StatefulSessionHome getHome() throws Exception
+ {
+ Properties env = new Properties();
+ env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+
+ InitialContext ctx = new InitialContext(env);
+
+ Object homeObj = ctx.lookup("jbas6006.StatefulSessionBean");
+ StatefulSessionHome home = (StatefulSessionHome) PortableRemoteObject.narrow(homeObj, StatefulSessionHome.class);
+
+ return home;
+ }
+
+ public static Test suite() throws Exception
+ {
+ return JBossTestCase.getDeploySetup(JBAS6006TestCase.class, "security-jbas6006.jar");
+ }
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,87 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
-
-import javax.ejb.CreateException;
-import javax.ejb.EJBException;
-import javax.ejb.SessionBean;
-import javax.ejb.SessionContext;
-
-/**
- *
- * @author darran.lofthouse at jboss.com
- * @since 30th September 2008
- */
-public class StatefulSessionBean implements SessionBean
-{
-
- private static final long serialVersionUID = -2925108063260951440L;
-
- private SessionContext ctx;
-
- public void ejbCreate(final String expectedCaller) throws CreateException
- {
- // Although this method is defined on the remote interface this is
- // a direct call so does not pass the interceptors again.
- testCaller(expectedCaller);
- }
-
- public void testCaller(final String expectedCaller)
- {
- String callerPrincipal = ctx.getCallerPrincipal().getName();
- if (expectedCaller.equals(callerPrincipal) == false)
- {
- throw new EJBException("Wrong CallerPrincipal expected='" + expectedCaller + "' actual='" + callerPrincipal
- + "'");
- }
- }
-
- /**
- * @see javax.ejb.SessionBean#ejbActivate()
- */
- public void ejbActivate()
- {
- }
-
- /**
- * @see javax.ejb.SessionBean#ejbPassivate()
- */
- public void ejbPassivate()
- {
- }
-
- /**
- * @see javax.ejb.SessionBean#ejbRemove()
- */
- public void ejbRemove()
- {
- }
-
- /**
- * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
- */
- public void setSessionContext(SessionContext ctx)
- {
- this.ctx = ctx;
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java (from rev 78985, branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionBean.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,87 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ *
+ * @author darran.lofthouse at jboss.com
+ * @since 30th September 2008
+ */
+public class StatefulSessionBean implements SessionBean
+{
+
+ private static final long serialVersionUID = -2925108063260951440L;
+
+ private SessionContext ctx;
+
+ public void ejbCreate(final String expectedCaller) throws CreateException
+ {
+ // Although this method is defined on the remote interface this is
+ // a direct call so does not pass the interceptors again.
+ testCaller(expectedCaller);
+ }
+
+ public void testCaller(final String expectedCaller)
+ {
+ String callerPrincipal = ctx.getCallerPrincipal().getName();
+ if (expectedCaller.equals(callerPrincipal) == false)
+ {
+ throw new EJBException("Wrong CallerPrincipal expected='" + expectedCaller + "' actual='" + callerPrincipal
+ + "'");
+ }
+ }
+
+ /**
+ * @see javax.ejb.SessionBean#ejbActivate()
+ */
+ public void ejbActivate()
+ {
+ }
+
+ /**
+ * @see javax.ejb.SessionBean#ejbPassivate()
+ */
+ public void ejbPassivate()
+ {
+ }
+
+ /**
+ * @see javax.ejb.SessionBean#ejbRemove()
+ */
+ public void ejbRemove()
+ {
+ }
+
+ /**
+ * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
+ */
+ public void setSessionContext(SessionContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,39 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
-
-import java.rmi.RemoteException;
-
-import javax.ejb.CreateException;
-import javax.ejb.EJBHome;
-
-/**
- *
- * @author darran.lofthouse at jboss.com
- * @since 30th September 2008
- */
-public interface StatefulSessionHome extends EJBHome
-{
-
- public StatefulSessionRemote create(final String expectedCaller) throws CreateException, RemoteException;
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java (from rev 78985, branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionHome.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ *
+ * @author darran.lofthouse at jboss.com
+ * @since 30th September 2008
+ */
+public interface StatefulSessionHome extends EJBHome
+{
+
+ public StatefulSessionRemote create(final String expectedCaller) throws CreateException, RemoteException;
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,38 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
-
-import java.rmi.RemoteException;
-
-import javax.ejb.EJBObject;
-
-/**
- *
- * @author darran.lofthouse at jboss.com
- * @since 30th September 2008
- */
-public interface StatefulSessionRemote extends EJBObject
-{
-
- public void testCaller(final String expectedCaller) throws RemoteException;
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java (from rev 78985, branches/Branch_4_2/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/ejb/jbas6006/StatefulSessionRemote.java 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.ejb.jbas6006;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ *
+ * @author darran.lofthouse at jboss.com
+ * @since 30th September 2008
+ */
+public interface StatefulSessionRemote extends EJBObject
+{
+
+ public void testCaller(final String expectedCaller) throws RemoteException;
+
+}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006 (from rev 78985, branches/Branch_4_2/testsuite/src/resources/security/jbas6006)
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/jbas6006/ejb-jar.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
- 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"
- version="2.1">
-
- <enterprise-beans>
- <session>
- <description>The Stateful Session Bean</description>
- <ejb-name>StatefulSessionBean</ejb-name>
- <home>org.jboss.test.security.ejb.jbas6006.StatefulSessionHome</home>
- <remote>org.jboss.test.security.ejb.jbas6006.StatefulSessionRemote</remote>
- <ejb-class>org.jboss.test.security.ejb.jbas6006.StatefulSessionBean</ejb-class>
- <session-type>Stateful</session-type>
- <transaction-type>Container</transaction-type>
- </session>
- </enterprise-beans>
-
- <assembly-descriptor>
-
- <method-permission>
- <unchecked/>
- <method>
- <ejb-name>StatefulSessionBean</ejb-name>
- <method-name>*</method-name>
- </method>
- </method-permission>
-
- </assembly-descriptor>
-</ejb-jar>
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml (from rev 78985, branches/Branch_4_2/testsuite/src/resources/security/jbas6006/ejb-jar.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/ejb-jar.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ 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"
+ version="2.1">
+
+ <enterprise-beans>
+ <session>
+ <description>The Stateful Session Bean</description>
+ <ejb-name>StatefulSessionBean</ejb-name>
+ <home>org.jboss.test.security.ejb.jbas6006.StatefulSessionHome</home>
+ <remote>org.jboss.test.security.ejb.jbas6006.StatefulSessionRemote</remote>
+ <ejb-class>org.jboss.test.security.ejb.jbas6006.StatefulSessionBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+
+ <assembly-descriptor>
+
+ <method-permission>
+ <unchecked/>
+ <method>
+ <ejb-name>StatefulSessionBean</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ </method-permission>
+
+ </assembly-descriptor>
+</ejb-jar>
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/jbas6006/jboss.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE jboss PUBLIC
- "-//JBoss//DTD JBOSS 4.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
-
-<!-- The jboss.xml descriptor for the caller info tests -->
-<jboss>
- <security-domain>java:/jaas/jbas6006-test</security-domain>
-
- <enterprise-beans>
- <session>
- <ejb-name>StatefulSessionBean</ejb-name>
- <jndi-name>jbas6006.StatefulSessionBean</jndi-name>
- </session>
- </enterprise-beans>
-
-</jboss>
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml (from rev 78985, branches/Branch_4_2/testsuite/src/resources/security/jbas6006/jboss.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/jboss.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 4.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+
+<!-- The jboss.xml descriptor for the caller info tests -->
+<jboss>
+ <security-domain>java:/jaas/jbas6006-test</security-domain>
+
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatefulSessionBean</ejb-name>
+ <jndi-name>jbas6006.StatefulSessionBean</jndi-name>
+ </session>
+ </enterprise-beans>
+
+</jboss>
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/jbas6006/login-config.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jbosstest:caller-info"
- targetNamespace="urn:jbosstest:caller-info"
- >
-
- <application-policy name="jbas6006-test">
- <authentication>
- <login-module code="org.jboss.security.auth.spi.XMLLoginModule" flag="required">
- <module-option name="userInfo">
- <lm:users xmlns:lm="http://www.jboss.org/j2ee/schemas/XMLLoginModule">
- <lm:user name="jduke" password="theduke">
- <lm:role name="User"/>
- </lm:user>
- </lm:users>
- </module-option>
- <module-option name="unauthenticatedIdentity">guest</module-option>
- </login-module>
- </authentication>
- </application-policy>
-
-</policy>
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml (from rev 78985, branches/Branch_4_2/testsuite/src/resources/security/jbas6006/login-config.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-config.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jbosstest:caller-info"
+ targetNamespace="urn:jbosstest:caller-info"
+ >
+
+ <application-policy name="jbas6006-test">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.XMLLoginModule" flag="required">
+ <module-option name="userInfo">
+ <lm:users xmlns:lm="http://www.jboss.org/j2ee/schemas/XMLLoginModule">
+ <lm:user name="jduke" password="theduke">
+ <lm:role name="User"/>
+ </lm:user>
+ </lm:users>
+ </module-option>
+ <module-option name="unauthenticatedIdentity">guest</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+</policy>
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/jbas6006/login-service.xml 2008-10-01 09:30:27 UTC (rev 78985)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<server>
- <!-- The custom JAAS login configuration service that installs
- a Configuration capable of dynamically updating the
- config settings
- -->
- <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
- name="jboss.security.tests:service=DynamicLoginConfig">
- <attribute name="AuthConfig">META-INF/login-config.xml</attribute>
- <depends optional-attribute-name="LoginConfigService">
- jboss.security:service=XMLLoginConfig
- </depends>
- <depends optional-attribute-name="SecurityManagerService">
- jboss.security:service=JaasSecurityManager
- </depends>
- </mbean>
-
-</server>
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml (from rev 78985, branches/Branch_4_2/testsuite/src/resources/security/jbas6006/login-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/jbas6006/login-service.xml 2008-10-01 09:47:46 UTC (rev 78986)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <!-- The custom JAAS login configuration service that installs
+ a Configuration capable of dynamically updating the
+ config settings
+ -->
+ <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
+ name="jboss.security.tests:service=DynamicLoginConfig">
+ <attribute name="AuthConfig">META-INF/login-config.xml</attribute>
+ <depends optional-attribute-name="LoginConfigService">
+ jboss.security:service=XMLLoginConfig
+ </depends>
+ <depends optional-attribute-name="SecurityManagerService">
+ jboss.security:service=JaasSecurityManager
+ </depends>
+ </mbean>
+
+</server>
More information about the jboss-cvs-commits
mailing list