11 Replies Latest reply on Feb 2, 2009 4:27 AM by alesj

    Security Deployer assuming VFSDeploymentUnit

    anil.saldhana

      Thomas has raised a JIRA issue
      https://jira.jboss.org/jira/browse/JBAS-6425

      I am opening this thread to see if I can get some second opinion from Ales, Adrian and Scott on this.

        • 1. Re: Security Deployer assuming VFSDeploymentUnit
          anil.saldhana

          There is some discussion that is related to this:
          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123146#4123146

          • 2. Re: Security Deployer assuming VFSDeploymentUnit
            anil.saldhana

            Thomas is creating a DU which is in memory and of type AbstractDeploymentUnit. The sec deployer is not happy as it expects a vfs DU. Maybe thomas needs to look at the vfs memory Du (something, like "vfsmemory://"

            A possibility is to create a deployer that goes before security deployer on demand and converts into a vfs DU. The other option is use vfs in-memory deployment.

            • 3. Re: Security Deployer assuming VFSDeploymentUnit
              thomas.diesler

              The background is that I am trying to implement an OSGi HttpService that dynamically deploys an JbossWebMetaData attached to an AbstractDeploymentUnit

               AbstractDeployment deployment = new AbstractDeployment(alias);
               //factory.addContext(deployment, "");
              
               ClassLoader classLoader = servlet.getClass().getClassLoader();
              
               MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
               mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory(classLoader));
               mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
               mainDeployer.deploy(deployment);
              


              should it be possible to deploy an AbstractDeployment or is VFSDeploymentUnit the only valid option?

              • 4. Re: Security Deployer assuming VFSDeploymentUnit
                alesj

                Why does AbstractSecurityDeployer assume VFSDeploymentUnit?

                Thomas, perhaps some VFS im-memory usage will get you past it.

                I'll look into details tomorrow.

                • 5. Re: Security Deployer assuming VFSDeploymentUnit
                  thomas.diesler

                  After fixing the bug in AbstractSecurityDeployer there seems to be more

                  19:04:56,160 INFO [STDOUT] Caused by: org.jboss.deployers.spi.DeploymentException: Structure can only be determined for VFSDeployments org.jboss.deployers.client.plugins.deployment.AbstractDeployment@6145c5
                  19:04:56,160 INFO [STDOUT] at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:213)
                  19:04:56,160 INFO [STDOUT] at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:77)
                  19:04:56,160 INFO [STDOUT] at org.jboss.deployers.plugins.main.MainDeployerImpl.determineStructure(MainDeployerImpl.java:853)
                  19:04:56,160 INFO [STDOUT] at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:303)
                  19:04:56,160 INFO [STDOUT] at org.jboss.deployers.plugins.main.MainDeployerImpl.deploy(MainDeployerImpl.java:413)
                  19:04:56,203 INFO [STDOUT] at org.jboss.osgi.service.http.beans.WebAppGeneratorService.registerServlet(WebAppGeneratorService.java:79)
                  


                  Should the StructuralDeployers even kick in if a deployment is not a VFS deployment?

                  • 6. Re: Security Deployer assuming VFSDeploymentUnit
                    alesj
                    • 7. Re: Security Deployer assuming VFSDeploymentUnit
                      thomas.diesler

                      Yes, and I believe we got it to work in AS42. However, I confirmed with Alessio tht the WS Endpoint API probably never worked in AS50. The related tests in JBossWS are disabled.

                      Perhaps we can revisit this now and cut through it for AS50

                      Here is how I currently try to do this

                       AbstractDeployment deployment = new AbstractDeployment(alias);
                       factory.addContext(deployment, "");
                      
                       ClassLoader classLoader = servlet.getClass().getClassLoader();
                      
                       MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
                       mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory(classLoader));
                       mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
                       mainDeployer.deploy(deployment);
                      


                      https://svn.jboss.org/repos/jbossas/projects/jboss-felix/trunk/modules/service/http-beans/src/main/java/org/jboss/osgi/service/http/beans/WebAppGeneratorService.java

                      • 8. Re: Security Deployer assuming VFSDeploymentUnit
                        alesj

                        This should work, as there is a StructureMD check before you demand VFSDeployment:
                        AbstractStructuralDeployers.java

                         Attachments attachments = deployment.getPredeterminedManagedObjects();
                         StructureMetaData structureMetaData = attachments.getAttachment(StructureMetaData.class);
                         if (structureMetaData == null)
                         {
                         structureMetaData = StructureMetaDataFactory.createStructureMetaData();
                         try
                         {
                         determineStructure(deployment, structureMetaData);
                        

                        where determineStructure() is only impled for VFS based deployments.

                        But since you already have StructureMD,
                        you should be by-passing that VFSD check.

                        • 9. Re: Security Deployer assuming VFSDeploymentUnit

                          Thomas shouldn't have to make his deployment a dummy VFSDeployment for this to work.

                          If the SecurityDeployer (and other deployers) don't work without a VFS file then there
                          is something wrong with them.

                          Either they shouldn't be looking at the deployment at all or they need to be
                          to fixed such that Thomas can pass in whatever metadata the SecurityDeployer is trying
                          to determine from the VFS.

                          If the fix is the latter then it shows the Security integration with the deployers is incomplete.

                          I doubt the Tomcat deployer works without a VFS file either currently since it will want to use
                          that to get the content for the web context.

                          • 10. Re: Security Deployer assuming VFSDeploymentUnit
                            dimitris

                            I believe the changes break some tests:

                            http://hudson.qa.jboss.com/hudson/view/JBoss%20AS/job/JBoss-AS-5.0.x-testSuite-jrockit16/134/testReport/

                            org.jboss.test.jacc.test.FormAuthUnitTestCase(JACC).testFormAuthException
                            org.jboss.test.security.test.WebJASPIFormUnitTestCase(tests-security-basic-unit).unknown
                            org.jboss.test.web.security.GenericHeaderAuthUnitTestCase.testGenericHeaderBaseAuth
                            org.jboss.test.web.test.FormAuthUnitTestCase.testFormAuthException

                            • 11. Re: Security Deployer assuming VFSDeploymentUnit
                              alesj

                              They also break the api. ;-)