[jboss-cvs] JBossAS SVN: r75705 - in trunk: testsuite/imports/sections and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 11 12:42:46 EDT 2008


Author: sguilhen at redhat.com
Date: 2008-07-11 12:42:45 -0400 (Fri, 11 Jul 2008)
New Revision: 75705

Added:
   trunk/testsuite/src/resources/web/federation/authext/application.xml
Removed:
   trunk/testsuite/src/resources/web/federation/authext/server.xml
   trunk/tomcat/src/main/org/jboss/web/tomcat/security/config/
Modified:
   trunk/testsuite/build.xml
   trunk/testsuite/imports/sections/web.xml
   trunk/testsuite/src/main/org/jboss/test/web/security/AuthenticatorsExternalizationTestCase.java
   trunk/testsuite/src/resources/web/federation/authext/header-auth/WEB-INF/jboss-web.xml
   trunk/testsuite/src/resources/web/federation/authext/war-deployers-beans.xml
   trunk/testsuite/src/resources/web/jaspi-form-auth/jboss-service.xml
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java
Log:
JBAS-5585: Added code to JBossContextConfig to register the authenticators configured in the TomcatDeployer. Fixed the ear structure used in the AuthenticatorsExternalizationTestCase.



Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/build.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -794,6 +794,7 @@
    <patternset id="tc-federation.includes">
       <include name="org/jboss/test/web/security/*TestCase.class"/>
       <include name="org/jboss/test/web/test/FormAuthUnitTestCase.class"/>
+      <exclude name="org/jboss/test/web/security/GenericHeaderAuthUnitTestCase.class"/>
    </patternset>
    <!-- Tests needing tomcat SSL -->
    <patternset id="tc-ssl.includes">
@@ -850,6 +851,8 @@
       <exclude name="org/jboss/test/cluster/multicfg/test/ClusterFileTransferTestCase.class"/>
    	<!-- Unfinished test of clustered deployment via profile service -->
       <exclude name="org/jboss/test/cluster/defaultcfg/profileservice/test/ClusteredDeployUnitTestCase.class"/>
+      <!-- JASPI needs revisiting -->
+      <exclude name="org/jboss/test/web/test/JASPIFormAuthUnitTestCase.class"/>
    </patternset>
 	
    <patternset id="jbossmq.excludes">
@@ -1129,7 +1132,6 @@
          </patternset>
       </create-config>
       <copy file="${source.resources}/web/federation/authext/war-deployers-beans.xml" overwrite="true" todir="${jboss.dist}/server/tomcat-federation/deployers/jbossweb.deployer/META-INF" />
-      <copy file="${source.resources}/web/federation/authext/server.xml" overwrite="true" todir="${jboss.dist}/server/tomcat-federation/deploy/jbossweb.sar" />
       <copy file="${build.lib}/header-auth.jar" overwrite="true" todir="${jboss.dist}/server/tomcat-federation/deploy/jbossweb.sar" />
       <server:start name="tomcat-federation"/>
       <run-junit junit.patternset="tc-federation.includes"

Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/imports/sections/web.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -333,14 +333,10 @@
          <zipfileset dir="${build.resources}/web/jaspi-form-auth" prefix="META-INF">
             <include name="application.xml"/>
             <include name="jboss-app.xml"/>
-            <include name="security-config.xml"/>
          </zipfileset>
-         <zipfileset dir="${build.resources}/web" fullpath="form-auth-users.properties"
-            includes="users.properties"/>
-         <zipfileset dir="${build.resources}/web" fullpath="form-auth-roles.properties"
-            includes="roles.properties"/>
          <zipfileset dir="${build.lib}" includes="jaspi-form-auth.war"/>
-         <zipfileset dir="${build.resources}/web/jaspi-form-auth" includes="jboss-service.xml"/>
+      	 <zipfileset dir="${build.lib}" includes="form-auth-resources.jar" fullpath="lib/form-auth-resources.jar"/>
+      	 <zipfileset dir="${build.resources}/web/jaspi-form-auth" includes="jboss-service.xml"/>
       </zip>
 
       <!-- war to test SSL and CLIENT-CERT auth -->
@@ -496,20 +492,6 @@
          </fileset>
        </jar>
      
-      <!-- build auth-ext-header-web.war -->
-      <war warfile="${build.lib}/auth-ext-header-web.war"
-         webxml="${build.resources}/web/federation/authext/header-auth/WEB-INF/web.xml">
-         <webinf dir="${build.resources}/web/federation/authext/header-auth/WEB-INF">
-            <include name="jboss-web.xml" />
-         </webinf> 
-         <fileset dir="${build.resources}/web/federation/authext/header-auth">
-           <include name="*.jsp"/>
-         </fileset>
-         <fileset dir="${build.resources}/web">
-           <include name="*.properties"/>
-         </fileset>
-      </war>
-     
       <!-- JASPI Stuff-->
       <war warfile="${build.lib}/jbosssx-jaspi-web.war"
          webxml="${build.resources}/web/jaspi/jaspi-test/jbosssx-jaspi-web.xml"> 
@@ -577,13 +559,13 @@
             <include name="**/*.jsp"/>
          </fileset>
       </war>
-      <jar destfile="${build.lib}/security_config.jar">
+      <!--jar destfile="${build.lib}/security_config.jar">
          <zipfileset dir="${build.resources}/web" fullpath="form-auth-users.properties" includes="users.properties"/>
          <zipfileset dir="${build.resources}/web" fullpath="form-auth-roles.properties" includes="roles.properties"/>
          <zipfileset dir="${build.resources}/web/form-auth">
             <include name="security-config.xml"/>
          </zipfileset>
-      </jar>
+      </jar-->
       <zip destfile="${build.lib}/header-form-auth.ear">
          <zipfileset dir="${build.resources}/web/form-auth" prefix="META-INF">
             <include name="jboss-app.xml"/>
@@ -592,7 +574,7 @@
             <include name="application.xml"/>
          </zipfileset>
          <zipfileset dir="${build.lib}" includes="header-form-auth.war"/>
-         <zipfileset dir="${build.lib}" includes="security_config.jar" fullpath="lib/security_config.jar"/>
+         <zipfileset dir="${build.lib}" includes="form-auth-resources.jar" fullpath="lib/form-auth-resources.jar"/>
          <zipfileset dir="${build.resources}/web/form-auth" includes="jboss-service.xml"/>
       </zip>
 
@@ -619,11 +601,34 @@
             <include name="application.xml"/>
          </zipfileset>
          <zipfileset dir="${build.lib}" includes="generic-header-auth.war"/>
-         <zipfileset dir="${build.lib}" includes="security_config.jar" fullpath="lib/security_config.jar"/>
+         <zipfileset dir="${build.lib}" includes="form-auth-resources.jar" fullpath="lib/form-auth-resources.jar"/>
          <zipfileset dir="${build.resources}/web/form-auth"
             includes="jboss-service.xml"/>
       </zip>
 
+      <!-- Authenticator Externalization -->
+      <war warfile="${build.lib}/auth-ext-header-web.war"
+        webxml="${build.resources}/web/federation/authext/header-auth/WEB-INF/web.xml">
+         <webinf dir="${build.resources}/web/federation/authext/header-auth/WEB-INF">
+            <include name="jboss-web.xml" />
+         </webinf> 
+         <fileset dir="${build.resources}/web/federation/authext/header-auth">
+            <include name="*.jsp"/>
+         </fileset>
+      </war>
+      <zip destfile="${build.lib}/auth-ext-header-web.ear">
+         <zipfileset dir="${build.resources}/web/form-auth" prefix="META-INF">
+            <include name="jboss-app.xml"/>
+         </zipfileset>
+         <zipfileset dir="${build.resources}/web/federation/authext" prefix="META-INF">
+            <include name="application.xml"/>
+         </zipfileset>
+         <zipfileset dir="${build.lib}" includes="auth-ext-header-web.war"/>
+         <zipfileset dir="${build.lib}" includes="form-auth-resources.jar" fullpath="lib/form-auth-resources.jar"/>
+         <zipfileset dir="${build.resources}/web/form-auth"
+            includes="jboss-service.xml"/>
+      </zip>
+
       <!-- Simple war for testing web app enc setup using descriptors -->
       <war destfile="${build.lib}/simple-xmlonly.war"
          webxml="${build.resources}/web/simple-xmlonly/web.xml">

Modified: trunk/testsuite/src/main/org/jboss/test/web/security/AuthenticatorsExternalizationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/security/AuthenticatorsExternalizationTestCase.java	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/src/main/org/jboss/test/web/security/AuthenticatorsExternalizationTestCase.java	2008-07-11 16:42:45 UTC (rev 75705)
@@ -1,67 +1,70 @@
 /*
-  * 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.web.security;
 
-//$Id$
+// $Id$
 import java.net.HttpURLConnection;
-import javax.management.MBeanServerConnection; 
+import javax.management.MBeanServerConnection;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.jboss.test.JBossTestCase;
 
 /**
- *  JBAS-2481: Externalization of Tomcat Authenticators
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @since  Dec 1, 2005
+ * JBAS-2481: Externalization of Tomcat Authenticators
+ * 
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Dec 1, 2005
  */
 public class AuthenticatorsExternalizationTestCase extends JBossTestCase
-{ 
+{
    MBeanServerConnection server = null;
-   private String baseURLNoAuth ; 
-   
-   
+
+   private String baseURLNoAuth;
+
    public AuthenticatorsExternalizationTestCase(String name)
    {
-      super(name); 
+      super(name);
    }
-   
+
+   @Override
    public void setUp() throws Exception
    {
       super.setUp();
       baseURLNoAuth = "http://" + getServerHost() + ":" + Integer.getInteger("web.port", 8080) + "/";
       this.serverFound();
-      this.deploy("auth-ext-header-web.war");  
+      this.deploy("auth-ext-header-web.ear");
       server = getServer();
       assertNotNull("Obtained MBeanServerConnection?", server);
    }
-   
+
+   @Override
    public void tearDown() throws Exception
    {
-      if(server != null)
+      if (server != null)
          server = null;
-      this.undeploy("auth-ext-header-web.war"); 
-   } 
-   
+      this.undeploy("auth-ext-header-web.ear");
+   }
+
    /**
     * Test custom header based authentication
     * 
@@ -69,33 +72,35 @@
     */
    public void testHeaderBasedAuthentication() throws Exception
    {
-      String location = baseURLNoAuth+"header-auth/index.jsp";
+      String location = baseURLNoAuth + "header-auth/index.jsp";
       int responseCode = 0;
       HttpClient httpConn = new HttpClient();
       GetMethod indexGet = null;
       try
       {
-         indexGet = new GetMethod(location); 
+         indexGet = new GetMethod(location);
          indexGet.setFollowRedirects(false);
          responseCode = httpConn.executeMethod(indexGet);
-         assertEquals(HttpURLConnection.HTTP_FORBIDDEN, responseCode );
-      }finally
+         assertEquals(HttpURLConnection.HTTP_FORBIDDEN, responseCode);
+      }
+      finally
       {
          indexGet.releaseConnection();
-      } 
+      }
       indexGet = null;
       try
       {
          indexGet = new GetMethod(location);
          indexGet.setFollowRedirects(false);
-         //Add the request headers
+         // Add the request headers
          indexGet.addRequestHeader("JBOSS_TEST_USER_NAME", "jduke");
          indexGet.addRequestHeader("JBOSS_TEST_CREDENTIAL", "theduke");
          responseCode = httpConn.executeMethod(indexGet);
-         assertEquals(HttpURLConnection.HTTP_OK,responseCode);
-      }finally
+         assertEquals(HttpURLConnection.HTTP_OK, responseCode);
+      }
+      finally
       {
          indexGet.releaseConnection();
-      } 
-   } 
+      }
+   }
 }

Added: trunk/testsuite/src/resources/web/federation/authext/application.xml
===================================================================
--- trunk/testsuite/src/resources/web/federation/authext/application.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/web/federation/authext/application.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+   "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+   "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+   <display-name>JBossTest Web Container Federation Tests</display-name>
+
+   <module>
+      <web>
+         <web-uri>auth-ext-header-web.war</web-uri>
+         <context-root>header-auth</context-root>
+      </web>
+   </module>
+
+</application>

Modified: trunk/testsuite/src/resources/web/federation/authext/header-auth/WEB-INF/jboss-web.xml
===================================================================
--- trunk/testsuite/src/resources/web/federation/authext/header-auth/WEB-INF/jboss-web.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/src/resources/web/federation/authext/header-auth/WEB-INF/jboss-web.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -4,5 +4,10 @@
     "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
 
 <jboss-web>
-  <context-root>/header-auth</context-root> 
+   <!-- Specify the security domain for authentication/authorization and
+   require that the domain's cache be flushed when the session invalidates.
+   -->
+   <security-domain flushOnSessionInvalidation="true">
+       java:/jaas/jbossweb-form-auth
+  </security-domain>
 </jboss-web>

Deleted: trunk/testsuite/src/resources/web/federation/authext/server.xml
===================================================================
--- trunk/testsuite/src/resources/web/federation/authext/server.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/src/resources/web/federation/authext/server.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -1,27 +0,0 @@
-<Server> 
-
-   <!-- Use a custom version of StandardService that allows the
-   connectors to be started independent of the normal lifecycle
-   start to allow web apps to be deployed before starting the
-   connectors.
-   -->
-   <Service name="jboss.web">
-
-      <!-- A HTTP/1.1 Connector on port 8080 -->
-      <Connector port="8080" address="${jboss.bind.address}"
-         maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
-         enableLookups="false" redirectPort="8443" acceptCount="100"
-         connectionTimeout="20000" disableUploadTimeout="true"/>  
-
-      <Engine name="jboss.web" defaultHost="localhost"> 
-         <Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
-            certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping" />   
-		 
-		 <Host name="localhost"
-            autoDeploy="false" deployOnStartup="false" deployXML="false"
-		    configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
-		 </Host> 
-      </Engine> 
-   </Service>
-
-</Server>

Modified: trunk/testsuite/src/resources/web/federation/authext/war-deployers-beans.xml
===================================================================
--- trunk/testsuite/src/resources/web/federation/authext/war-deployers-beans.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/src/resources/web/federation/authext/war-deployers-beans.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -203,7 +203,9 @@
 
        <!-- Specify a SecurityContext FQN class name -->
        <property name="securityContextClassName">org.jboss.security.plugins.JBossSecurityContext</property> 
-      
+        
+       <property name="httpHeaderForSSOAuth">sm_ssoid,ct-remote-user,HTTP_OBLIX_UID</property>
+       <property name="sessionCookieForSSOAuth">SMSESSION,CTSESSION,ObSSOCookie</property> 
    </bean>
    
    <bean name="MergedJBossWebMetaDataDeployer" 

Modified: trunk/testsuite/src/resources/web/jaspi-form-auth/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/web/jaspi-form-auth/jboss-service.xml	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/testsuite/src/resources/web/jaspi-form-auth/jboss-service.xml	2008-07-11 16:42:45 UTC (rev 75705)
@@ -8,7 +8,7 @@
    -->
    <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
       name="jboss.security.tests:service=LoginConfig">
-      <attribute name="AuthConfig">META-INF/security-config.xml</attribute>
+      <attribute name="AuthConfig">security-config.xml</attribute>
       <depends optional-attribute-name="LoginConfigService">
          jboss.security:service=XMLLoginConfig
       </depends>

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java	2008-07-11 16:42:45 UTC (rev 75705)
@@ -21,11 +21,19 @@
  */
 package org.jboss.web.tomcat.service.deployers;
 
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
 
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.ContextConfig;
+import org.jboss.logging.Logger;
 import org.jboss.metadata.javaee.spec.DescriptionGroupMetaData;
 import org.jboss.metadata.javaee.spec.ParamValueMetaData;
 import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
@@ -50,38 +58,56 @@
 import org.jboss.metadata.web.spec.MimeMappingMetaData;
 import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
 import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.ServletsMetaData;
 import org.jboss.metadata.web.spec.SessionConfigMetaData;
 import org.jboss.metadata.web.spec.TaglibMetaData;
 import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.Web25MetaData;
-import org.jboss.metadata.web.spec.WebMetaData;
 import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
 import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
 import org.jboss.metadata.web.spec.WelcomeFileListMetaData;
 
+ at SuppressWarnings("unchecked")
 public class JBossContextConfig extends ContextConfig
 {
-	public static ThreadLocal<JBossWebMetaData> metaDataLocal = new ThreadLocal<JBossWebMetaData>();
+   public static ThreadLocal<JBossWebMetaData> metaDataLocal = new ThreadLocal<JBossWebMetaData>();
+
    public static ThreadLocal<JBossWebMetaData> metaDataShared = new ThreadLocal<JBossWebMetaData>();
 
-    @Override
-	protected void applicationWebConfig()
-    {
+   private static Logger log = Logger.getLogger(JBossContextConfig.class);
+
+   /**
+    * <p>
+    * Creates a new instance of {@code JBossContextConfig}.
+    * </p>
+    */
+   public JBossContextConfig()
+   {
+      super();
+      try
+      {
+         Map authMap = this.getAuthenticators();
+         if (authMap.size() > 0)
+            customAuthenticators = authMap;
+      }
+      catch (Exception e)
+      {
+         log.debug("Failed to load the customized authenticators", e);
+      }
+   }
+
+   @Override
+   protected void applicationWebConfig()
+   {
       processWebMetaData(metaDataLocal.get());
    }
-    
-    
+
    @Override
    protected void defaultWebConfig()
    {
       processWebMetaData(metaDataShared.get());
    }
 
-
    protected void processWebMetaData(JBossWebMetaData metaData)
-   {   
+   {
       if (context instanceof StandardContext)
       {
          ((StandardContext) context).setReplaceWelcomeFiles(true);
@@ -90,29 +116,29 @@
       // Metadata complete
       context.setIgnoreAnnotations(metaData.isMetadataComplete());
 
-      // SetPublicId 
-      if ( metaData.is25())
-          context.setPublicId("/javax/servlet/resources/web-app_2_5.dtd");
-      else if ( metaData.is24())
-          context.setPublicId("/javax/servlet/resources/web-app_2_4.dtd");
-      else if (  metaData.is23())
-          context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_23);
+      // SetPublicId
+      if (metaData.is25())
+         context.setPublicId("/javax/servlet/resources/web-app_2_5.dtd");
+      else if (metaData.is24())
+         context.setPublicId("/javax/servlet/resources/web-app_2_4.dtd");
+      else if (metaData.is23())
+         context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_23);
       else
-          context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_22);
-    	
-    	// Context params
+         context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_22);
+
+      // Context params
       List<ParamValueMetaData> params = metaData.getContextParams();
-      if(params != null)
+      if (params != null)
       {
-       	for(ParamValueMetaData param : params)
+         for (ParamValueMetaData param : params)
          {
-       		context.addParameter(param.getParamName(), param.getParamValue());
-       	}
+            context.addParameter(param.getParamName(), param.getParamValue());
+         }
       }
-    	
-    	// Display name
+
+      // Display name
       DescriptionGroupMetaData dg = metaData.getDescriptionGroup();
-      if(dg != null)
+      if (dg != null)
       {
          String displayName = dg.getDisplayName();
          if (displayName != null)
@@ -120,233 +146,230 @@
             context.setDisplayName(displayName);
          }
       }
-    	
-    	// Distributable
+
+      // Distributable
       if (metaData.getDistributable() != null)
          context.setDistributable(true);
 
-    	// Error pages
+      // Error pages
       List<ErrorPageMetaData> errorPages = metaData.getErrorPages();
-      if(errorPages != null)
+      if (errorPages != null)
       {
-         for(ErrorPageMetaData value : errorPages)
+         for (ErrorPageMetaData value : errorPages)
          {
-       		org.apache.catalina.deploy.ErrorPage errorPage =
-       			new org.apache.catalina.deploy.ErrorPage();
-       		errorPage.setErrorCode(value.getErrorCode());
+            org.apache.catalina.deploy.ErrorPage errorPage = new org.apache.catalina.deploy.ErrorPage();
+            errorPage.setErrorCode(value.getErrorCode());
             errorPage.setExceptionType(value.getExceptionType());
-       		errorPage.setLocation(value.getLocation());
-       		context.addErrorPage(errorPage);
-       	}
+            errorPage.setLocation(value.getLocation());
+            context.addErrorPage(errorPage);
+         }
       }
 
-    	// Filter definitions
+      // Filter definitions
       FiltersMetaData filters = metaData.getFilters();
-      if(filters != null)
+      if (filters != null)
       {
-         for(FilterMetaData value : filters)
+         for (FilterMetaData value : filters)
          {
-       		org.apache.catalina.deploy.FilterDef filterDef =
-       			new org.apache.catalina.deploy.FilterDef();
-       		filterDef.setFilterName(value.getName());
-       		filterDef.setFilterClass(value.getFilterClass());
-            if(value.getInitParam() != null)
-            for(ParamValueMetaData param : value.getInitParam())
-            {
-               filterDef.addInitParameter(param.getParamName(), param.getParamValue());
-            }
-       		context.addFilterDef(filterDef);
-       	}
+            org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
+            filterDef.setFilterName(value.getName());
+            filterDef.setFilterClass(value.getFilterClass());
+            if (value.getInitParam() != null)
+               for (ParamValueMetaData param : value.getInitParam())
+               {
+                  filterDef.addInitParameter(param.getParamName(), param.getParamValue());
+               }
+            context.addFilterDef(filterDef);
+         }
       }
-    	
-    	// Filter mappings
+
+      // Filter mappings
       List<FilterMappingMetaData> filtersMappings = metaData.getFilterMappings();
-      if(filtersMappings != null)
+      if (filtersMappings != null)
       {
-         for(FilterMappingMetaData value : filtersMappings)
-       	{
-       		org.apache.catalina.deploy.FilterMap filterMap =
-       			new org.apache.catalina.deploy.FilterMap();
-       		filterMap.setFilterName(value.getFilterName());
+         for (FilterMappingMetaData value : filtersMappings)
+         {
+            org.apache.catalina.deploy.FilterMap filterMap = new org.apache.catalina.deploy.FilterMap();
+            filterMap.setFilterName(value.getFilterName());
             List<String> servletNames = value.getServletNames();
-            if(servletNames != null)
+            if (servletNames != null)
             {
-               for(String name : servletNames)
+               for (String name : servletNames)
                   filterMap.addServletName(name);
             }
             List<String> urlPatterns = value.getUrlPatterns();
-            if(urlPatterns != null)
+            if (urlPatterns != null)
             {
-               for(String pattern : urlPatterns)
+               for (String pattern : urlPatterns)
                   filterMap.addURLPattern(pattern);
             }
             List<DispatcherType> dispatchers = value.getDispatchers();
-            if(dispatchers != null)
+            if (dispatchers != null)
             {
-               for(DispatcherType type : dispatchers)
+               for (DispatcherType type : dispatchers)
                   filterMap.setDispatcher(type.name());
             }
-       	    context.addFilterMap(filterMap);
-       	}
+            context.addFilterMap(filterMap);
+         }
       }
 
-    	// Listeners
+      // Listeners
       List<ListenerMetaData> listeners = metaData.getListeners();
-      if(listeners != null)
+      if (listeners != null)
       {
-       	for (ListenerMetaData value : listeners)
+         for (ListenerMetaData value : listeners)
          {
-       		context.addApplicationListener(value.getListenerClass());
-       	}
+            context.addApplicationListener(value.getListenerClass());
+         }
       }
-    	
-    	// Login configuration
+
+      // Login configuration
       LoginConfigMetaData loginConfig = metaData.getLoginConfig();
-      if(loginConfig != null)
+      if (loginConfig != null)
       {
-    		org.apache.catalina.deploy.LoginConfig loginConfig2 =
-    			new org.apache.catalina.deploy.LoginConfig();
-    		loginConfig2.setAuthMethod(loginConfig.getAuthMethod());
-    		loginConfig2.setRealmName(loginConfig.getRealmName());
-    		if (loginConfig.getFormLoginConfig() != null) {
-    			loginConfig2.setLoginPage(loginConfig.getFormLoginConfig().getLoginPage());
-    			loginConfig2.setErrorPage(loginConfig.getFormLoginConfig().getErrorPage());
-    		}
-    		context.setLoginConfig(loginConfig2);
+         org.apache.catalina.deploy.LoginConfig loginConfig2 = new org.apache.catalina.deploy.LoginConfig();
+         loginConfig2.setAuthMethod(loginConfig.getAuthMethod());
+         loginConfig2.setRealmName(loginConfig.getRealmName());
+         if (loginConfig.getFormLoginConfig() != null)
+         {
+            loginConfig2.setLoginPage(loginConfig.getFormLoginConfig().getLoginPage());
+            loginConfig2.setErrorPage(loginConfig.getFormLoginConfig().getErrorPage());
+         }
+         context.setLoginConfig(loginConfig2);
       }
-    	
+
       // MIME mappings
       List<MimeMappingMetaData> mimes = metaData.getMimeMappings();
-      if(mimes != null)
+      if (mimes != null)
       {
          for (MimeMappingMetaData value : mimes)
          {
             context.addMimeMapping(value.getExtension(), value.getMimeType());
          }
       }
-    	
-    	// Security constraints
+
+      // Security constraints
       List<SecurityConstraintMetaData> scs = metaData.getSecurityContraints();
-      if(scs != null)
+      if (scs != null)
       {
-       	for(SecurityConstraintMetaData value : scs)
+         for (SecurityConstraintMetaData value : scs)
          {
-       		org.apache.catalina.deploy.SecurityConstraint constraint =
-       			new org.apache.catalina.deploy.SecurityConstraint();
+            org.apache.catalina.deploy.SecurityConstraint constraint = new org.apache.catalina.deploy.SecurityConstraint();
             TransportGuaranteeType tg = value.getTransportGuarantee();
-       		constraint.setUserConstraint(tg.name());
+            constraint.setUserConstraint(tg.name());
             AuthConstraintMetaData acmd = value.getAuthConstraint();
-       		constraint.setAuthConstraint(acmd != null);
-       		if (acmd != null)
+            constraint.setAuthConstraint(acmd != null);
+            if (acmd != null)
             {
-               if(acmd.getRoleNames() != null)
-       			for(String role : acmd.getRoleNames())
-               {
-       				constraint.addAuthRole(role);
-       			}
-       		}
+               if (acmd.getRoleNames() != null)
+                  for (String role : acmd.getRoleNames())
+                  {
+                     constraint.addAuthRole(role);
+                  }
+            }
             WebResourceCollectionsMetaData wrcs = value.getResourceCollections();
-            if(wrcs != null)
+            if (wrcs != null)
             {
-          		for(WebResourceCollectionMetaData wrc : wrcs)
+               for (WebResourceCollectionMetaData wrc : wrcs)
                {
-          			org.apache.catalina.deploy.SecurityCollection collection2 = 
-          				new org.apache.catalina.deploy.SecurityCollection();
-          			collection2.setName(wrc.getName());
+                  org.apache.catalina.deploy.SecurityCollection collection2 = new org.apache.catalina.deploy.SecurityCollection();
+                  collection2.setName(wrc.getName());
                   List<String> methods = wrc.getHttpMethods();
-                  if(methods != null)
+                  if (methods != null)
                   {
-             			for (String method : wrc.getHttpMethods())
+                     for (String method : wrc.getHttpMethods())
                      {
-             				collection2.addMethod(method);
-             			}
+                        collection2.addMethod(method);
+                     }
                   }
                   List<String> patterns = wrc.getUrlPatterns();
-                  if(patterns != null)
+                  if (patterns != null)
                   {
-             			for (String pattern : patterns)
+                     for (String pattern : patterns)
                      {
-             				collection2.addPattern(pattern);
+                        collection2.addPattern(pattern);
                      }
                   }
-          			constraint.addCollection(collection2);
-          		}
+                  constraint.addCollection(collection2);
+               }
             }
-       		context.addConstraint(constraint);
-       	}
+            context.addConstraint(constraint);
+         }
       }
 
-    	// Security roles
+      // Security roles
       SecurityRolesMetaData roles = metaData.getSecurityRoles();
-      if(roles != null)
+      if (roles != null)
       {
-       	for (SecurityRoleMetaData value : roles)
+         for (SecurityRoleMetaData value : roles)
          {
-       		context.addSecurityRole(value.getRoleName());
-       	}
+            context.addSecurityRole(value.getRoleName());
+         }
       }
 
-    	// Servlet
+      // Servlet
       JBossServletsMetaData servlets = metaData.getServlets();
-      if(servlets != null)
+      if (servlets != null)
       {
-       	for (JBossServletMetaData value : servlets)
+         for (JBossServletMetaData value : servlets)
          {
-       		org.apache.catalina.Wrapper wrapper = context.createWrapper();
-       		wrapper.setName(value.getName());
-       		wrapper.setServletClass(value.getServletClass());
-       		if (value.getJspFile() != null) {
-       		   wrapper.setJspFile(value.getJspFile());
-       		}
-       		wrapper.setLoadOnStartup(value.getLoadOnStartup());
-       		if (value.getRunAs() != null) {
-       			wrapper.setRunAs(value.getRunAs().getRoleName());
-       		}
+            org.apache.catalina.Wrapper wrapper = context.createWrapper();
+            wrapper.setName(value.getName());
+            wrapper.setServletClass(value.getServletClass());
+            if (value.getJspFile() != null)
+            {
+               wrapper.setJspFile(value.getJspFile());
+            }
+            wrapper.setLoadOnStartup(value.getLoadOnStartup());
+            if (value.getRunAs() != null)
+            {
+               wrapper.setRunAs(value.getRunAs().getRoleName());
+            }
             params = value.getInitParam();
-            if(params != null)
+            if (params != null)
             {
-               for(ParamValueMetaData param : params)
+               for (ParamValueMetaData param : params)
                {
                   wrapper.addInitParameter(param.getParamName(), param.getParamValue());
                }
             }
             SecurityRoleRefsMetaData refs = value.getSecurityRoleRefs();
-            if(refs != null)
+            if (refs != null)
             {
-          		for (SecurityRoleRefMetaData ref : refs)
+               for (SecurityRoleRefMetaData ref : refs)
                {
-          			wrapper.addSecurityReference(ref.getRoleName(), ref.getRoleLink());
-          		}
+                  wrapper.addSecurityReference(ref.getRoleName(), ref.getRoleLink());
+               }
             }
-       		context.addChild(wrapper);
-       	}
+            context.addChild(wrapper);
+         }
       }
 
-    	// Servlet mapping
+      // Servlet mapping
       List<ServletMappingMetaData> smappings = metaData.getServletMappings();
-      if(smappings != null)
+      if (smappings != null)
       {
-       	for (ServletMappingMetaData value : smappings)
+         for (ServletMappingMetaData value : smappings)
          {
-           List<String> urlPatterns = value.getUrlPatterns();
-           if(urlPatterns != null)
-           {
-              for(String pattern : urlPatterns)
-               context.addServletMapping(pattern, value.getServletName());
-           }
-       	}
+            List<String> urlPatterns = value.getUrlPatterns();
+            if (urlPatterns != null)
+            {
+               for (String pattern : urlPatterns)
+                  context.addServletMapping(pattern, value.getServletName());
+            }
+         }
       }
-    	
+
       // JSP mappings
       JspConfigMetaData config = metaData.getJspConfig();
-      if(config != null)
+      if (config != null)
       {
          List<JspPropertyGroup> groups = config.getPropertyGroups();
-         if(groups != null)
+         if (groups != null)
          {
             for (JspPropertyGroup group : groups)
             {
-               for(String pattern : group.getUrlPatterns())
+               for (String pattern : group.getUrlPatterns())
                {
                   context.addJspMapping(pattern);
                }
@@ -354,9 +377,9 @@
          }
          // Taglib
          List<TaglibMetaData> taglibs = config.getTaglibs();
-         if(taglibs != null)
+         if (taglibs != null)
          {
-            for(TaglibMetaData taglib : taglibs)
+            for (TaglibMetaData taglib : taglibs)
             {
                context.addTaglib(taglib.getTaglibUri(), taglib.getTaglibLocation());
             }
@@ -367,17 +390,17 @@
       LocaleEncodingsMetaData locales = metaData.getLocalEncodings();
       if (locales != null)
       {
-         for(LocaleEncodingMetaData value : locales.getMappings())
+         for (LocaleEncodingMetaData value : locales.getMappings())
          {
             context.addLocaleEncodingMappingParameter(value.getLocale(), value.getEncoding());
          }
       }
 
-    	// Welcome files
+      // Welcome files
       WelcomeFileListMetaData welcomeFiles = metaData.getWelcomeFileList();
       if (welcomeFiles != null)
       {
-         for(String value : welcomeFiles.getWelcomeFiles())
+         for (String value : welcomeFiles.getWelcomeFiles())
             context.addWelcomeFile(value);
       }
 
@@ -387,6 +410,50 @@
       {
          context.setSessionTimeout(scmd.getSessionTimeout());
       }
-	}
+   }
 
+   /**
+    * <p>
+    * Retrieves the map of authenticators according to the settings made available by {@code TomcatService}.
+    * </p>
+    * 
+    * @return a {@code Map} containing the authenticator that must be used for each authentication method.
+    * @throws Exception if an error occurs while getting the authenticators.
+    */
+   protected Map getAuthenticators() throws Exception
+   {
+      Map authenticators = new HashMap();
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+
+      Properties authProps = this.getAuthenticatorsFromJndi();
+      if (authProps != null)
+      {
+         Set keys = authProps.keySet();
+         Iterator iter = keys != null ? keys.iterator() : null;
+         while (iter != null && iter.hasNext())
+         {
+            String key = (String) iter.next();
+            String authenticatorStr = (String) authProps.get(key);
+            Class authClass = tcl.loadClass(authenticatorStr);
+            authenticators.put(key, authClass.newInstance());
+         }
+      }
+      if (log.isTraceEnabled())
+         log.trace("Authenticators plugged in::" + authenticators);
+      return authenticators;
+   }
+
+   /**
+    * <p>
+    * Get the key-pair of authenticators from the JNDI.
+    * </p>
+    * 
+    * @return a {@code Properties} object containing the authenticator class name for each authentication method.
+    * @throws NamingException if an error occurs while looking up the JNDI.
+    */
+   private Properties getAuthenticatorsFromJndi() throws NamingException
+   {
+      return (Properties) new InitialContext().lookup("TomcatAuthenticators");
+   }
+
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployerMBean.java	2008-07-11 16:42:45 UTC (rev 75705)
@@ -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.web.tomcat.service.deployers;
 
 import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
@@ -26,12 +26,9 @@
 import org.jboss.web.deployers.AbstractWarDeployerMBean;
 
 /**
- * An implementation of the AbstractWebContainer for the Jakarta Tomcat5
- * servlet container. It has no code dependency on tomcat - only the new JMX
- * model is used.
- * <p/>
- * Tomcat5 is organized as a set of mbeans - just like jboss.
- *
+ * An implementation of the AbstractWebContainer for the Jakarta Tomcat5 servlet container. It has no code dependency on
+ * tomcat - only the new JMX model is used. <p/> Tomcat5 is organized as a set of mbeans - just like jboss.
+ * 
  * @author Scott.Stark at jboss.org
  * @author Costin Manolache
  * @version $Revision: 45726 $
@@ -39,19 +36,18 @@
  */
 public interface TomcatDeployerMBean extends AbstractWarDeployerMBean
 {
-   /** JMX notification type to signal after-start connector event */ 
-   public final String TOMCAT_CONNECTORS_STARTED  = "jboss.tomcat.connectors.started";
-   
+   /** JMX notification type to signal after-start connector event */
+   public final String TOMCAT_CONNECTORS_STARTED = "jboss.tomcat.connectors.started";
+
    /**
     * @return the jmx domain for the tomcat management mbeans
     */
    public String getDomain();
 
    /**
-    * The most important attribute - defines the managed domain.
-    * A catalina instance (engine) corresponds to a JMX domain, that's
-    * how we know where to deploy webapps.
-    *
+    * The most important attribute - defines the managed domain. A catalina instance (engine) corresponds to a JMX
+    * domain, that's how we know where to deploy webapps.
+    * 
     * @param domainName the jmx domain under which tc registers
     */
    public void setDomain(String domainName);
@@ -65,7 +61,7 @@
     * The SessionIdAlphabet is the set of characters used to create a session Id
     */
    public String getSessionIdAlphabet();
-   
+
    /**
     * Get the JBoss UCL use flag
     */
@@ -88,14 +84,14 @@
 
    /**
     * Get the name of the external tomcat server configuration file.
-    *
+    * 
     * @return the config file name, server.xml for example
     */
    public String getConfigFile();
 
    /**
     * Set the name of the external tomcat server configuration file.
-    *
+    * 
     * @param configFile - the config file name, server.xml for example
     */
    public void setConfigFile(String configFile);
@@ -106,10 +102,9 @@
    public String getSubjectAttributeName();
 
    /**
-    * Set the request attribute name under which the JAAS Subject will be
-    * stored when running with a security mgr that supports JAAS. If this is
-    * empty then the Subject will not be store in the request.
-    *
+    * Set the request attribute name under which the JAAS Subject will be stored when running with a security mgr that
+    * supports JAAS. If this is empty then the Subject will not be store in the request.
+    * 
     * @param name the HttpServletRequest attribute name to store the Subject
     */
    public void setSubjectAttributeName(String name);
@@ -124,20 +119,64 @@
     */
    public void setAllowSelfPrivilegedWebApps(boolean flag);
 
-   /** Set the SecurityManagerService binding. This is used to flush any
-    * associated authentication cache on session invalidation.
+   /**
+    * Set the SecurityManagerService binding. This is used to flush any associated authentication cache on session
+    * invalidation.
+    * 
     * @param mgr the JaasSecurityManagerServiceMBean
-    */ 
+    */
    public void setSecurityManagerService(JaasSecurityManagerServiceMBean mgr);
 
    /**
     * 
     * @return
-    */ 
+    */
    public String[] getFilteredPackages();
+
    /**
     * 
     * @param pkgs
-    */ 
+    */
    public void setFilteredPackages(String[] pkgs);
+
+   /**
+    * <p>
+    * Obtain the value of the {@code httpHeaderForSSOAuth} property. This property is used to indicate what request
+    * header ids will be used to retrieve the SSO identity set by a third party security system.
+    * </p>
+    * 
+    * @return the value of the {@code httpHeaderForSSOAuth} property.
+    */
+   public String getHttpHeaderForSSOAuth();
+
+   /**
+    * <p>
+    * Set the value of the {@code httpHeaderForSSOAuth} property. This property is used to indicate what request header
+    * ids will be used to retrieve the SSO identity set by a third party security system.
+    * </p>
+    * 
+    * @param httpHeaderForSSOAuth a {@code String} containing the request header ids separated by comma.
+    */
+   public void setHttpHeaderForSSOAuth(String httpHeaderForSSOAuth);
+
+   /**
+    * <p>
+    * Obtain the value of the {@code sessionCookieForSSOAuth} property. This property is used to indicate the names of
+    * the SSO cookies that may be present in the request object.
+    * </p>
+    * 
+    * @return the value of the {@code sessionCookieForSSOAuth} property.
+    */
+   public String getSessionCookieForSSOAuth();
+
+   /**
+    * <p>
+    * Set the value of the {@code sessionCookieForSSOAuth} property. This property is used to indicate the names of the
+    * SSO cookies that may be present in the request object.
+    * </p>
+    * 
+    * @param sessionCookieForSSOAuth a {@code String} containing the names (separated by comma) of the SSO cookies.
+    */
+   public void setSessionCookieForSSOAuth(String sessionCookieForSSOAuth);
+
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java	2008-07-11 16:05:49 UTC (rev 75704)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java	2008-07-11 16:42:45 UTC (rev 75705)
@@ -46,33 +46,27 @@
 import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
 
 /**
- * Temporary workaround to support controlling the lifecycle of the webserver 
- * runtime portion of TomcatDeployer via a JMX service in the deploy directory.  
- * We want it in deploy so dependencies on services in deploy can be properly 
- * expressed. We want it as a JMX service so the ServiceBindingManager can 
- * alter the connector ports.
+ * Temporary workaround to support controlling the lifecycle of the webserver runtime portion of TomcatDeployer via a
+ * JMX service in the deploy directory. We want it in deploy so dependencies on services in deploy can be properly
+ * expressed. We want it as a JMX service so the ServiceBindingManager can alter the connector ports.
  * <p>
  * A more long term solution involves:
  * <ol>
- * <li>separating out the JBossWeb runtime aspects from TomcatDeployer and 
- * putting them in a separate class</li>
+ * <li>separating out the JBossWeb runtime aspects from TomcatDeployer and putting them in a separate class</li>
  * <li>developing a ProfileService-based alternative to ServiceBindingManager</li>
  * </ol>
- * </p> 
- *  
+ * </p>
+ * 
  * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  * @version $Revision: 1.1 $
  */
-public class TomcatService 
-    extends ServiceMBeanSupport
-    implements NotificationListener, TomcatServiceMBean
+public class TomcatService extends ServiceMBeanSupport implements NotificationListener, TomcatServiceMBean
 {
-   /** The associated Tomcat deployer **/
+   /** The associated Tomcat deployer * */
    private TomcatDeployer tomcatDeployer;
-   
-   
+
    // Dependency inject the TomcatDeployer pojo
-   
+
    public TomcatDeployer getTomcatDeployer()
    {
       return tomcatDeployer;
@@ -82,7 +76,7 @@
    {
       this.tomcatDeployer = tomcatDeployer;
    }
-   
+
    // In our lifecycle, we invoke the webserver lifecycle-related operations
    // in the TomcatDeployer
 
@@ -93,83 +87,75 @@
          throw new IllegalStateException("Must set TomcatDeployer before starting");
 
       tomcatDeployer.setServiceClassLoader(getClass().getClassLoader());
-      
+
       // Load Catalina properties
       CatalinaProperties.getProperty("");
-      
+
       log.debug("Starting tomcat deployer");
       MBeanServer server = super.getServer();
-      System.setProperty("catalina.ext.dirs",
-         (System.getProperty("jboss.server.home.dir")
-         + File.separator + "lib"));
-      
+      System.setProperty("catalina.ext.dirs", (System.getProperty("jboss.server.home.dir") + File.separator + "lib"));
+
       String objectNameS = tomcatDeployer.getDomain() + ":type=server";
       ObjectName objectName = new ObjectName(objectNameS);
 
       // Set the modeler Registry MBeanServer to the that of the tomcat service
       Registry.getRegistry().setMBeanServer(server);
 
-      Registry.getRegistry().registerComponent(Class.forName("org.apache.catalina.startup.Catalina").newInstance(), 
-              objectName, "org.apache.catalina.startup.Catalina");
+      Registry.getRegistry().registerComponent(Class.forName("org.apache.catalina.startup.Catalina").newInstance(),
+            objectName, "org.apache.catalina.startup.Catalina");
 
-      server.setAttribute(objectName, new Attribute
-         ("catalinaHome",
-            System.getProperty("jboss.server.home.dir")));
-      server.setAttribute(objectName, new Attribute
-         ("configFile", tomcatDeployer.getConfigFile()));
-      server.setAttribute(objectName, new Attribute
-         ("useNaming", new Boolean(false)));
-      server.setAttribute(objectName, new Attribute
-         ("useShutdownHook", new Boolean(false)));
-      server.setAttribute(objectName, new Attribute
-         ("await", new Boolean(false)));
-      server.setAttribute(objectName, new Attribute
-         ("redirectStreams", new Boolean(false)));
+      server.setAttribute(objectName, new Attribute("catalinaHome", System.getProperty("jboss.server.home.dir")));
+      server.setAttribute(objectName, new Attribute("configFile", tomcatDeployer.getConfigFile()));
+      server.setAttribute(objectName, new Attribute("useNaming", new Boolean(false)));
+      server.setAttribute(objectName, new Attribute("useShutdownHook", new Boolean(false)));
+      server.setAttribute(objectName, new Attribute("await", new Boolean(false)));
+      server.setAttribute(objectName, new Attribute("redirectStreams", new Boolean(false)));
 
-      server.invoke(objectName, "create", new Object[]{},
-         new String[]{});
+      server.invoke(objectName, "create", new Object[]{}, new String[]{});
 
-      server.invoke(objectName, "start", new Object[]{},
-         new String[]{});
-      
-      //Set up the authenticators in JNDI such that they can be configured for web apps
+      server.invoke(objectName, "start", new Object[]{}, new String[]{});
+
+      // Set up the authenticators in JNDI such that they can be configured for web apps
       InitialContext ic = new InitialContext();
       try
       {
-        ic.bind("TomcatAuthenticators", tomcatDeployer.getAuthenticators()); 
+         ic.bind("TomcatAuthenticators", tomcatDeployer.getAuthenticators());
       }
-      catch(NamingException ne)
+      catch (NamingException ne)
       {
-        if(log.isTraceEnabled())
-           log.trace("Binding Authenticators to JNDI failed",ne);
+         if (log.isTraceEnabled())
+            log.trace("Binding Authenticators to JNDI failed", ne);
       }
       finally
-      { 
-          try{ ic.close();}catch(NamingException nee){}
+      {
+         try
+         {
+            ic.close();
+         }
+         catch (NamingException nee)
+         {
+         }
       }
 
       // Register the web container JACC PolicyContextHandlers
       HttpServletRequestPolicyContextHandler handler = new HttpServletRequestPolicyContextHandler();
-      PolicyContext.registerHandler(HttpServletRequestPolicyContextHandler.WEB_REQUEST_KEY,
-         handler, true);
+      PolicyContext.registerHandler(HttpServletRequestPolicyContextHandler.WEB_REQUEST_KEY, handler, true);
 
       // If we are hot-deployed *after* the overall server is started
       // we'll never receive Server.START_NOTIFICATION_TYPE, so check
       // with the Server and start the connectors immediately, if this is the case.
       // Otherwise register to receive the server start-up notification.
-      Boolean started = (Boolean)server.getAttribute(ServerImplMBean.OBJECT_NAME, "Started");
+      Boolean started = (Boolean) server.getAttribute(ServerImplMBean.OBJECT_NAME, "Started");
       if (started.booleanValue() == true)
       {
-         log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
-               "' already started, starting connectors now");
+         log.debug("Server '" + ServerImplMBean.OBJECT_NAME + "' already started, starting connectors now");
 
          startConnectors();
       }
       else
       {
          // Register for notification of the overall server startup
-         log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
-               "' not started, registering for start-up notification");
+         log.debug("Server '" + ServerImplMBean.OBJECT_NAME + "' not started, registering for start-up notification");
 
          server.addNotificationListener(ServerImplMBean.OBJECT_NAME, this, null, null);
       }
@@ -184,24 +170,21 @@
          throw new IllegalStateException("Must set TomcatDeployer before stopping");
 
       // Hot undeploy
-      Boolean inShutdown = (Boolean)server.getAttribute(ServerImplMBean.OBJECT_NAME, "InShutdown");
+      Boolean inShutdown = (Boolean) server.getAttribute(ServerImplMBean.OBJECT_NAME, "InShutdown");
       if (inShutdown.booleanValue() == false)
       {
-         log.debug("Server '" + ServerImplMBean.OBJECT_NAME +
-               "' already started, stopping connectors now");
+         log.debug("Server '" + ServerImplMBean.OBJECT_NAME + "' already started, stopping connectors now");
 
          stopConnectors();
       }
-      
+
       MBeanServer server = super.getServer();
       String objectNameS = tomcatDeployer.getDomain() + ":type=server";
       ObjectName objectName = new ObjectName(objectNameS);
 
-      server.invoke(objectName, "stop", new Object[]{},
-         new String[]{});
+      server.invoke(objectName, "stop", new Object[]{}, new String[]{});
 
-      server.invoke(objectName, "destroy", new Object[]{},
-         new String[]{});
+      server.invoke(objectName, "destroy", new Object[]{}, new String[]{});
 
       server.unregisterMBean(objectName);
 
@@ -209,8 +192,7 @@
 
       // Unregister any remaining jboss.web or Catalina MBeans
       ObjectName queryObjectName = new ObjectName(tomcatDeployer.getDomain() + ":*");
-      Iterator iterator =
-         server2.queryMBeans(queryObjectName, null).iterator();
+      Iterator iterator = server2.queryMBeans(queryObjectName, null).iterator();
       while (iterator.hasNext())
       {
          ObjectInstance oi = (ObjectInstance) iterator.next();
@@ -232,9 +214,9 @@
          ObjectName name = oi.getObjectName();
          server2.unregisterMBean(name);
       }
-      
+
    }
-   
+
    // Expose the TomcatDeployer MBean interface
 
    public String getConfigFile()
@@ -351,18 +333,16 @@
       ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web");
       Object[] args = {};
       String[] sig = {};
-      Connector[] connectors = (Connector[]) server.invoke(service,
-         "findConnectors", args, sig);
+      Connector[] connectors = (Connector[]) server.invoke(service, "findConnectors", args, sig);
       for (int n = 0; n < connectors.length; n++)
       {
-         Lifecycle lc = (Lifecycle) connectors[n];
+         Lifecycle lc = connectors[n];
          lc.start();
       }
-      /* TODO:
-      // Notify listeners that connectors have started processing requests
-      sendNotification(new Notification(TOMCAT_CONNECTORS_STARTED,
-            this, getNextNotificationSequenceNumber()));
-      */
+      /*
+       * TODO: // Notify listeners that connectors have started processing requests sendNotification(new
+       * Notification(TOMCAT_CONNECTORS_STARTED, this, getNextNotificationSequenceNumber()));
+       */
    }
 
    public void stopConnectors() throws Exception
@@ -374,18 +354,17 @@
       ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web");
       Object[] args = {};
       String[] sig = {};
-      Connector[] connectors = (Connector[]) server.invoke(service,
-         "findConnectors", args, sig);
+      Connector[] connectors = (Connector[]) server.invoke(service, "findConnectors", args, sig);
       for (int n = 0; n < connectors.length; n++)
       {
-          connectors[n].pause();
-          connectors[n].stop();
+         connectors[n].pause();
+         connectors[n].stop();
       }
    }
 
    /**
-    * Used to receive notification of the server start msg so the tomcat
-    * connectors can be started after all web apps are deployed.
+    * Used to receive notification of the server start msg so the tomcat connectors can be started after all web apps
+    * are deployed.
     */
    public void handleNotification(Notification msg, Object handback)
    {
@@ -460,4 +439,45 @@
          tomcatDeployer.setUnpackWars(flag);
    }
 
+   /*
+    * (non-Javadoc)
+    * 
+    * @see org.jboss.web.tomcat.service.deployers.TomcatDeployerMBean#getHttpHeaderForSSOAuth()
+    */
+   public String getHttpHeaderForSSOAuth()
+   {
+      return tomcatDeployer == null ? null : tomcatDeployer.getHttpHeaderForSSOAuth();
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see org.jboss.web.tomcat.service.deployers.TomcatDeployerMBean#setHttpHeaderForSSOAuth(java.lang.String)
+    */
+   public void setHttpHeaderForSSOAuth(String httpHeaderForSSOAuth)
+   {
+      if (this.tomcatDeployer != null)
+         this.tomcatDeployer.setHttpHeaderForSSOAuth(httpHeaderForSSOAuth);
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see org.jboss.web.tomcat.service.deployers.TomcatDeployerMBean#getSessionCookieForSSOAuth()
+    */
+   public String getSessionCookieForSSOAuth()
+   {
+      return tomcatDeployer == null ? null : tomcatDeployer.getSessionCookieForSSOAuth();
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see org.jboss.web.tomcat.service.deployers.TomcatDeployerMBean#setSessionCookieForSSOAuth(java.lang.String)
+    */
+   public void setSessionCookieForSSOAuth(String sessionCookieForSSOAuth)
+   {
+      if (this.tomcatDeployer != null)
+         this.tomcatDeployer.setSessionCookieForSSOAuth(sessionCookieForSSOAuth);
+   }
 }




More information about the jboss-cvs-commits mailing list