[jbossws-commits] JBossWS SVN: r3187 - in trunk: integration/jboss50/ant-import and 12 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue May 22 13:27:48 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-05-22 13:27:48 -0400 (Tue, 22 May 2007)
New Revision: 3187

Modified:
   trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB21.java
   trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB3.java
   trunk/integration/jboss50/ant-import/build-thirdparty.xml
   trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java
   trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java
   trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java
   trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java
   trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java
   trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java
   trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/metadata/sunjaxws/DDEndpoints.java
   trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServicesDeployer.java
   trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/metadata/services/DDBeans.java
   trunk/jbossws-core/ant-import-tests/build-testsuite.xml
   trunk/jbossws-core/ant-import/build-thirdparty.xml
   trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws723/JBWS723TestCase.java
   trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/samples/secureejb/SecureEJBTestCase.java
   trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
   trunk/jbossws-core/src/test/resources/jaxrpc/samples/secureejb/META-INF/jboss.xml
Log:
Fix ejb21 security 

Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB21.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB21.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB21.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -49,7 +49,12 @@
 
       String securityDomain = appMetaData.getSecurityDomain();
       if (securityDomain != null)
-         jbossWeb.addElement("security-domain").addText("java:/jaas/" + securityDomain);
+      {
+         if (securityDomain.startsWith("java:/jaas/") == false)
+            securityDomain = "java:/jaas/" + securityDomain;
+         
+         jbossWeb.addElement("security-domain").addText(securityDomain);
+      }
    }
 
    public void addSecurityRoles(Element webApp, Deployment dep)

Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB3.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB3.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityHandlerEJB3.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -71,7 +71,12 @@
       }
 
       if (securityDomain != null)
-         jbossWeb.addElement("security-domain").addText("java:/jaas/" + securityDomain);
+      {
+         if (securityDomain.startsWith("java:/jaas/") == false)
+            securityDomain = "java:/jaas/" + securityDomain;
+         
+         jbossWeb.addElement("security-domain").addText(securityDomain);
+      }
    }
 
    public void addSecurityRoles(Element webApp, Deployment dep)

Modified: trunk/integration/jboss50/ant-import/build-thirdparty.xml
===================================================================
--- trunk/integration/jboss50/ant-import/build-thirdparty.xml	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss50/ant-import/build-thirdparty.xml	2007-05-22 17:27:48 UTC (rev 3187)
@@ -50,6 +50,7 @@
       <pathelement location="${jboss50.server.lib}/jboss.jar"/>
       <pathelement location="${jboss50.server.lib}/jboss-javaee.jar"/>
       <pathelement location="${jboss50.server.lib}/jbosssx.jar"/>
+      <pathelement location="${jboss50.server.lib}/jboss-security-spi.jar"/>
       <pathelement location="${jboss50.server.deployers}/ejb3.deployer/jboss-ejb3.jar"/>
       <pathelement location="${jboss50.server.deployers}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
       

Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB21.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -40,7 +40,9 @@
 import org.jboss.invocation.PayloadKey;
 import org.jboss.logging.Logger;
 import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextUtil;
+import org.jboss.security.plugins.SecurityContextAssociation;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
 import org.jboss.wsf.spi.invocation.AbstractInvocationHandler;
@@ -126,10 +128,17 @@
    {
       log.debug("Invoke: " + inv.getJavaMethod().getName());
 
-      // these are provided by the ServerLoginHandler
-      Principal principal = SecurityAssociation.getPrincipal();
-      Object credential = SecurityAssociation.getCredential();
+      Principal principal = null;
+      Object credential = null;
 
+      SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
+      if (securityContext != null)
+      {
+         SecurityContextUtil util = securityContext.getUtil();
+         principal = util.getUserPrincipal();
+         credential = util.getCredential();
+      }
+
       // invoke on the container
       try
       {

Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/InvocationHandlerEJB3.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -79,7 +79,7 @@
          throw new WebServiceException("Cannot find service endpoint target: " + objectName);
    }
 
-   public void invoke(Endpoint ep, Object beanInstance, Invocation epInv) throws Exception
+   public void invoke(Endpoint ep, Object beanInstance, Invocation wsInv) throws Exception
    {
       try
       {
@@ -87,18 +87,18 @@
          StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
          Class beanClass = container.getBeanClass();
 
-         Method method = getImplMethod(beanClass, epInv.getJavaMethod());
-         Object[] args = epInv.getArgs();
+         Method method = getImplMethod(beanClass, wsInv.getJavaMethod());
+         Object[] args = wsInv.getArgs();
 
          MethodInfo info = container.getMethodInfo(method);
-         EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
-         ejb3Inv.setAdvisor(container);
-         ejb3Inv.setArguments(args);
-         ejb3Inv.setContextCallback(new CallbackImpl(epInv));
+         EJBContainerInvocation<StatelessContainer, StatelessBeanContext> jbInv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+         jbInv.setAdvisor(container);
+         jbInv.setArguments(args);
+         jbInv.setContextCallback(new CallbackImpl(wsInv));
 
-         Object retObj = ejb3Inv.invokeNext();
+         Object retObj = jbInv.invokeNext();
 
-         epInv.setReturnValue(retObj);
+         wsInv.setReturnValue(retObj);
       }
       catch (Throwable th)
       {

Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB21.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -49,7 +49,12 @@
       
       String securityDomain = appMetaData.getSecurityDomain();
       if (securityDomain != null)
-         jbossWeb.addElement("security-domain").addText("java:/jaas/" + securityDomain);
+      {
+         if (securityDomain.startsWith("java:/jaas/") == false)
+            securityDomain = "java:/jaas/" + securityDomain;
+         
+         jbossWeb.addElement("security-domain").addText(securityDomain);
+      }
    }
    
    public void addSecurityRoles(Element webApp, Deployment dep)

Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityHandlerEJB3.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -65,7 +65,12 @@
       }
       
       if (securityDomain != null)
-         jbossWeb.addElement("security-domain").addText("java:/jaas/" + securityDomain);
+      {
+         if (securityDomain.startsWith("java:/jaas/") == false)
+            securityDomain = "java:/jaas/" + securityDomain;
+         
+         jbossWeb.addElement("security-domain").addText(securityDomain);
+      }
    }
 
    public void addSecurityRoles(Element webApp, Deployment dep)

Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -38,6 +38,8 @@
 import org.jboss.wsf.spi.management.ServerConfig;
 import org.jboss.wsf.spi.management.ServerConfigFactory;
 import org.jboss.wsf.spi.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.UnifiedEjbPortComponentMetaData;
 
 /**
  * A deployer that generates a webapp for an EJB endpoint 
@@ -156,20 +158,34 @@
       // Add web-app/security-constraint for each port component
       for (Endpoint ep : dep.getService().getEndpoints())
       {
-         Class targetBean = ep.getTargetBeanClass();
+         String ejbName = ep.getShortName();
+         
          boolean secureWSDLAccess = false;
          String transportGuarantee = null;
          String beanAuthMethod = null;
 
-         WebContext anWebContext = (WebContext)targetBean.getAnnotation(WebContext.class);
-         if (anWebContext != null && anWebContext.authMethod().length() > 0)
-            beanAuthMethod = anWebContext.authMethod();
-         if (anWebContext != null && anWebContext.transportGuarantee().length() > 0)
-            transportGuarantee = anWebContext.transportGuarantee();
-         if (anWebContext != null && anWebContext.secureWSDLAccess())
-            secureWSDLAccess = anWebContext.secureWSDLAccess();
+         WebContext anWebContext = (WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
+         UnifiedApplicationMetaData appMetaData = dep.getContext().getAttachment(UnifiedApplicationMetaData.class);
+         if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) != null)
+         {
+            UnifiedBeanMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
+            UnifiedEjbPortComponentMetaData pc = bmd.getPortComponent();
+            if (pc != null)
+            {
+               beanAuthMethod = pc.getAuthMethod();
+               transportGuarantee = pc.getTransportGuarantee();
+            }
+         }
+         else if(anWebContext != null)
+         {
+            if (anWebContext.authMethod().length() > 0)
+               beanAuthMethod = anWebContext.authMethod();
+            if (anWebContext.transportGuarantee().length() > 0)
+               transportGuarantee = anWebContext.transportGuarantee();
+            if (anWebContext.secureWSDLAccess())
+               secureWSDLAccess = anWebContext.secureWSDLAccess();
+         }
 
-         String ejbName = ep.getShortName();
          if (beanAuthMethod != null || transportGuarantee != null)
          {
             /*

Modified: trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java
===================================================================
--- trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -53,4 +53,14 @@
       }
       dep.getContext().addAttachment(DDEndpoints.class, dd);
    }
+
+   @Override
+   public void destroy(Deployment dep)
+   {
+      DDEndpoints dd = dep.getContext().getAttachment(DDEndpoints.class);
+      if (dd != null)
+      {
+         dd.destroyFileURL();
+      }
+   }
 }
\ No newline at end of file

Modified: trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/metadata/sunjaxws/DDEndpoints.java
===================================================================
--- trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/metadata/sunjaxws/DDEndpoints.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/metadata/sunjaxws/DDEndpoints.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -31,8 +31,7 @@
 import java.util.List;
 
 import org.jboss.wsf.spi.deployment.WSDeploymentException;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.utils.IOUtils;
 
 //$Id$
 
@@ -61,10 +60,9 @@
    {
       destroyFileURL();
       
-      ServerConfig serverConfig = ServerConfigFactory.getInstance().getServerConfig();
-      File tmpDir = serverConfig.getServerTempDir();
       try
       {
+         File tmpDir = IOUtils.createTempDirectory();
          tmpFile = File.createTempFile("jbossws-sun-jaxws", ".xml", tmpDir);
          Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile));
          writeTo(writer);

Modified: trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServicesDeployer.java
===================================================================
--- trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServicesDeployer.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServicesDeployer.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -93,4 +93,15 @@
       }
       dep.getContext().addAttachment(DDBeans.class, dd);
    }
+
+
+   @Override
+   public void destroy(Deployment dep)
+   {
+      DDBeans dd = dep.getContext().getAttachment(DDBeans.class);
+      if (dd != null)
+      {
+         dd.destroyFileURL();
+      }
+   }
 }
\ No newline at end of file

Modified: trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/metadata/services/DDBeans.java
===================================================================
--- trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/metadata/services/DDBeans.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/metadata/services/DDBeans.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -33,8 +33,7 @@
 import java.util.List;
 
 import org.jboss.wsf.spi.deployment.WSDeploymentException;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.utils.IOUtils;
 
 //$Id$
 
@@ -77,10 +76,9 @@
    {
       destroyFileURL();
 
-      ServerConfig serverConfig = ServerConfigFactory.getInstance().getServerConfig();
-      File tmpDir = serverConfig.getServerTempDir();
       try
       {
+         File tmpDir = IOUtils.createTempDirectory();
          tmpFile = File.createTempFile("jbossws-xfire-services", ".xml", tmpDir);
          Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile));
          writeTo(writer);

Modified: trunk/jbossws-core/ant-import/build-thirdparty.xml
===================================================================
--- trunk/jbossws-core/ant-import/build-thirdparty.xml	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/ant-import/build-thirdparty.xml	2007-05-22 17:27:48 UTC (rev 3187)
@@ -79,6 +79,7 @@
     <get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-microcontainer-src.zip" dest="${thirdparty.dir}/jboss-microcontainer-src.zip" usetimestamp="true" verbose="true"/>
     <get src="${jboss.repository}/jboss/remoting/${jboss-remoting}/lib/jboss-remoting.jar" dest="${thirdparty.dir}/jboss-remoting.jar" usetimestamp="true" verbose="true"/>
     <get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx-client.jar" dest="${thirdparty.dir}/jbosssx-client.jar" usetimestamp="true" verbose="true"/>
+    <get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx.jar" dest="${thirdparty.dir}/jbosssx.jar" usetimestamp="true" verbose="true"/>
     <get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx-src.zip" dest="${thirdparty.dir}/jbosssx-src.zip" usetimestamp="true" verbose="true"/>
     <get src="${jboss.repository}/jbossas/core-libs/${jbossas-core-libs}/lib/jboss-j2ee.jar" dest="${thirdparty.dir}/jboss-j2ee.jar" usetimestamp="true" verbose="true"/>
     <get src="${jboss.repository}/jbpm/bpel/${jbpm-bpel}/lib/jbpm-bpel.sar" dest="${thirdparty.dir}/jbpm-bpel.sar" usetimestamp="true" verbose="true" />    
@@ -123,7 +124,7 @@
       <pathelement location="${thirdparty.dir}/jboss-microcontainer.jar"/>
       <pathelement location="${thirdparty.dir}/jboss-remoting.jar"/>
       <pathelement location="${thirdparty.dir}/jboss-xml-binding.jar"/>
-      <pathelement location="${thirdparty.dir}/jbosssx-client.jar"/>
+      <pathelement location="${thirdparty.dir}/jbosssx.jar"/>
       <pathelement location="${thirdparty.dir}/mail.jar"/>
       <pathelement location="${thirdparty.dir}/servlet-api.jar"/>
       <pathelement location="${thirdparty.dir}/stax-api.jar"/>

Modified: trunk/jbossws-core/ant-import-tests/build-testsuite.xml
===================================================================
--- trunk/jbossws-core/ant-import-tests/build-testsuite.xml	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/ant-import-tests/build-testsuite.xml	2007-05-22 17:27:48 UTC (rev 3187)
@@ -110,6 +110,7 @@
     <wsconsume wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesRpcLit/WEB-INF/wsdl/service.wsdl" package="org.jboss.test.ws.interop.soapwsdl.baserpclit" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
     <wsconsume wsdl="${tests.resources.dir}/jaxws/complex/META-INF/wsdl/RegistrationService.wsdl" package="org.jboss.test.ws.jaxws.complex" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
     <wsconsume wsdl="${tests.resources.dir}/jaxws/holder/META-INF/wsdl/HolderService.wsdl" package="org.jboss.test.ws.jaxws.holder" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
+    <wsconsume wsdl="${tests.resources.dir}/jaxws/samples/wssecurity/META-INF/wsdl/HelloService.wsdl" package="org.jboss.test.ws.jaxws.samples.wssecurity" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
   </target>
 
   <!--
@@ -201,6 +202,7 @@
       <classpath location="${tests.output.dir}/classes"/>
     </taskdef>    
     
+    <wsprovide resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity" genwsdl="true" sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean"/>
   </target>
   
   <target name="tests-generate-resources" depends="servicegen,wstools,wsprovide">

Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws723/JBWS723TestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws723/JBWS723TestCase.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws723/JBWS723TestCase.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -31,8 +31,6 @@
 
 import junit.framework.Test;
 
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SimplePrincipal;
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -57,39 +55,6 @@
       return JBossWSTestSetup.newTestSetup(JBWS723TestCase.class, "jaxrpc-jbws723.jar, jaxrpc-jbws723-client.jar");
    }
 
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      SecurityAssociation.setPrincipal(null);
-      SecurityAssociation.setCredential(null);
-   }
-
-   /** Test required principal/credential for this bean
-    */
-   public void testRoleSecuredSLSB() throws Exception
-   {
-      InitialContext iniCtx = getInitialContext();
-      OrganizationHome home = (OrganizationHome)iniCtx.lookup("ejb/RoleSecuredSLSB");
-
-      OrganizationRemote bean = null;
-      try
-      {
-         bean = home.create();
-         fail("Security exception expected");
-      }
-      catch (Exception e)
-      {
-         // all cool, now try again with valid credentials
-         SecurityAssociation.setPrincipal(new SimplePrincipal(USERNAME));
-         SecurityAssociation.setCredential(PASSWORD);
-         //bean = home.create();
-      }
-
-      System.out.println("FIXME: [JBWS-1330] Fix jaxrpc wsse tests for jbossws-5.0");
-      //String info = bean.getContactInfo("mafia");
-      //assertEquals("The 'mafia' boss is currently out of office, please call again.", info);
-   }
-
    public void testRoleSecuredWSDLAccess() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxrpc-jbws723/RoleSecured?wsdl");

Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/samples/secureejb/SecureEJBTestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/samples/secureejb/SecureEJBTestCase.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/samples/secureejb/SecureEJBTestCase.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -1,24 +1,24 @@
 /*
-  * 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
+ * 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.ws.jaxrpc.samples.secureejb;
 
 import java.net.URL;
@@ -31,14 +31,11 @@
 
 import junit.framework.Test;
 
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SimplePrincipal;
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.test.ws.JBossWSTestSetup;
 import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
 
-
 /**
  * A web service client that connects to a secured SLSB endpoint using.
  *
@@ -55,39 +52,6 @@
       return JBossWSTestSetup.newTestSetup(SecureEJBTestCase.class, "jaxrpc-samples-secureejb.jar, jaxrpc-samples-secureejb-client.jar");
    }
 
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      SecurityAssociation.setPrincipal(null);
-      SecurityAssociation.setCredential(null);
-   }
-
-   /** Test required principal/credential for this bean
-    */
-   public void testRoleSecuredSLSB() throws Exception
-   {
-      InitialContext iniCtx = getInitialContext();
-      OrganizationHome home = (OrganizationHome)iniCtx.lookup("ejb/RoleSecuredSLSB");
-
-      OrganizationRemote bean = null;
-      try
-      {
-         bean = home.create();
-         fail("Security exception expected");
-      }
-      catch (Exception e)
-      {
-         // all cool, now try again with valid credentials
-         SecurityAssociation.setPrincipal(new SimplePrincipal(USERNAME));
-         SecurityAssociation.setCredential(PASSWORD);
-         //bean = home.create();
-      }
-
-      System.out.println("FIXME: [JBWS-1330] Fix jaxrpc wsse tests for jbossws-5.0");
-      //String info = bean.getContactInfo("mafia");
-      //assertEquals("The 'mafia' boss is currently out of office, please call again.", info);
-   }
-
    public void testRoleSecuredWSDLAccess() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxrpc-samples-ejb/RoleSecured?wsdl");
@@ -95,7 +59,7 @@
       WSDLDefinitions wsdl = factory.parse(wsdlURL);
       assertNotNull("Expect unsecured wsdl access by default for jaxrpc", wsdl);
    }
-   
+
    public void testRoleSecuredServiceAccess() throws Exception
    {
       InitialContext iniCtx = getInitialContext();
@@ -165,14 +129,14 @@
       WSDLDefinitions wsdl = factory.parse(wsdlURL);
       assertNotNull("Expect unsecured wsdl access", wsdl);
    }
-   
+
    public void testConfidentialServiceAccess() throws Exception
    {
       InitialContext iniCtx = getInitialContext();
       Service service = (Service)iniCtx.lookup("java:comp/env/service/ConfidentialSecured");
       QName portName = new QName("http://org.jboss.ws/samples/secureejb", "ConfidentialPort");
       OrganizationService port = (OrganizationService)service.getPort(portName, OrganizationService.class);
-      
+
       Stub stub = (Stub)port;
       String address = (String)stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
       assertEquals("https://" + getServerHost() + ":8443/jaxrpc-samples-ejb/ConfidentialSecured", address);
@@ -182,17 +146,16 @@
       {
          stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://" + getServerHost() + ":8080/jaxrpc-samples-ejb/ConfidentialSecured");
          port.getContactInfo("mafia");
-         
+
          if (isTargetJBoss50())
             System.out.println("FIXME: [JBAS-3595] - Tomcat allows http access with transport guarantie CONFIDENTIAL");
-         else
-            fail("Security exception expected");
+         else fail("Security exception expected");
       }
       catch (RemoteException ignore)
       {
          // ignore expected exception
       }
-      
+
       // test confidential access
       //stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "https://" + getServerHost() + ":8443/jaxrpc-samples-ejb/ConfidentialSecured");
       //String info = port.getContactInfo("mafia");

Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/wsse/RoundTripTestCase.java	2007-05-22 17:27:48 UTC (rev 3187)
@@ -1,24 +1,24 @@
 /*
-  * 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
+ * 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.ws.jaxrpc.wsse;
 
 import java.io.ByteArrayInputStream;
@@ -32,7 +32,6 @@
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPMessage;
 
-import org.jboss.security.SecurityAssociation;
 import org.jboss.test.ws.JBossWSTest;
 import org.jboss.ws.core.soap.MessageFactoryImpl;
 import org.jboss.ws.extensions.security.Constants;
@@ -64,21 +63,12 @@
    /** Test that we can build an envelope from InputStream */
    public void testRoundTrip() throws Exception
    {
-      String envStr =
-         "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
-         " <env:Header>" +
-         "  <tns:someHeader xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'" +
-         "    tns:test='hi' xmlns:tns='http://org.jboss.ws/2004'>some header value</tns:someHeader>" +
-         " </env:Header> " +
-         " <env:Body>" +
-         "  <tns:echoString2 xmlns:tns='http://org.jboss.ws/2004'>" +
-         "   <string>Hello World!</string>" +
-         "  </tns:echoString2>" +
-         "  <tns:echoString xmlns:tns='http://org.jboss.ws/2004'>" +
-         "   <string>Hello World!</string>" +
-         "  </tns:echoString>" +
-         " </env:Body>" +
-         "</env:Envelope>";
+      String envStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + " <env:Header>"
+            + "  <tns:someHeader xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'"
+            + "    tns:test='hi' xmlns:tns='http://org.jboss.ws/2004'>some header value</tns:someHeader>" + " </env:Header> " + " <env:Body>"
+            + "  <tns:echoString2 xmlns:tns='http://org.jboss.ws/2004'>" + "   <string>Hello World!</string>" + "  </tns:echoString2>"
+            + "  <tns:echoString xmlns:tns='http://org.jboss.ws/2004'>" + "   <string>Hello World!</string>" + "  </tns:echoString>" + " </env:Body>"
+            + "</env:Envelope>";
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(envStr.getBytes());
 
@@ -111,9 +101,6 @@
 
       log.debug("Decoded message:" + DOMWriter.printNode(doc, true));
 
-      assertEquals(SecurityAssociation.getPrincipal().toString(), "hi");
-      assertEquals(SecurityAssociation.getCredential(), "there");
-
       assertEquals(inputString, DOMWriter.printNode(doc, true));
    }
 

Modified: trunk/jbossws-core/src/test/resources/jaxrpc/samples/secureejb/META-INF/jboss.xml
===================================================================
--- trunk/jbossws-core/src/test/resources/jaxrpc/samples/secureejb/META-INF/jboss.xml	2007-05-22 15:39:58 UTC (rev 3186)
+++ trunk/jbossws-core/src/test/resources/jaxrpc/samples/secureejb/META-INF/jboss.xml	2007-05-22 17:27:48 UTC (rev 3187)
@@ -1,18 +1,22 @@
 <?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">
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
 
 <jboss>
 
   <security-domain>java:/jaas/JBossWS</security-domain>
 
+  <webservices>
+    <context-root>/jaxrpc-samples-ejb</context-root>
+  </webservices>
+  
   <enterprise-beans>
     <session>
       <ejb-name>RoleSecuredSLSB</ejb-name>
       <jndi-name>ejb/RoleSecuredSLSB</jndi-name>
       <port-component>
         <port-component-name>RoleSecured</port-component-name>
-        <port-component-uri>/jaxrpc-samples-ejb/RoleSecured</port-component-uri>
+        <port-component-uri>/RoleSecured</port-component-uri>
         <auth-method>BASIC</auth-method>
         <transport-guarantee>NONE</transport-guarantee>
       </port-component>
@@ -22,7 +26,7 @@
       <jndi-name>ejb/BasicSecuredSLSB</jndi-name>
       <port-component>
         <port-component-name>BasicSecured</port-component-name>
-        <port-component-uri>/jaxrpc-samples-ejb/BasicSecured</port-component-uri>
+        <port-component-uri>/BasicSecured</port-component-uri>
         <auth-method>BASIC</auth-method>
         <transport-guarantee>NONE</transport-guarantee>
       </port-component>
@@ -32,7 +36,7 @@
       <jndi-name>ejb/ConfidentialSLSB</jndi-name>
       <port-component>
         <port-component-name>ConfidentialSecured</port-component-name>
-        <port-component-uri>/jaxrpc-samples-ejb/ConfidentialSecured</port-component-uri>
+        <port-component-uri>/ConfidentialSecured</port-component-uri>
         <transport-guarantee>CONFIDENTIAL</transport-guarantee>
       </port-component>
     </session>




More information about the jbossws-commits mailing list