[jboss-svn-commits] JBL Code SVN: r29513 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/internal/soa/esb/listeners/war and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 30 07:46:49 EDT 2009


Author: beve
Date: 2009-09-30 07:46:48 -0400 (Wed, 30 Sep 2009)
New Revision: 29513

Modified:
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
   labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/jboss-esb.xml
   labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/soap-login.xml
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2864 "Create global configuration section in jboss-esb.xml for setting that are global to the whole configuration file."


Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-09-30 11:46:48 UTC (rev 29513)
@@ -19,6 +19,8 @@
 		<xsd:complexType>
 			<xsd:sequence>
 				<xsd:element maxOccurs="1" minOccurs="0"
+					ref="jesb:globals" />
+				<xsd:element maxOccurs="1" minOccurs="0"
 					ref="jesb:providers" />
 				<xsd:element maxOccurs="1" minOccurs="0"
 					ref="jesb:services" />
@@ -44,6 +46,42 @@
 			</xsd:complexContent>
 		</xsd:complexType>
 	</xsd:element>
+	
+	<xsd:element name="globals">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">
+                A container for the configurations global to a jbossesb config file
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="war-security" minOccurs="0" maxOccurs="1">
+                    <xsd:annotation>
+                            <xsd:documentation xml:lang="en">
+                            Security configuration that is global to the jboss-esb.xml file. 
+                            These configuration settings are shared for all http-providers and EBWS that are defined in jboss-esb.xml.Domain.
+                            </xsd:documentation>
+                    </xsd:annotation>
+                    <xsd:complexType>
+                        <xsd:attribute name="method" use="optional" default="BASIC">
+	                        <xsd:simpleType>
+	                            <xsd:restriction base="xsd:NMTOKEN">
+		                            <xsd:enumeration value="BASIC" />
+	                                <xsd:enumeration value="DIGEST" />
+	                                <xsd:enumeration value="CLIENT-CERT" />
+	                            </xsd:restriction>
+	                        </xsd:simpleType>
+                        </xsd:attribute>
+                        <xsd:attribute name="domain" type="xsd:string" use="optional">
+                            <xsd:annotation>
+                                <xsd:documentation xml:lang="en">Security Domain.</xsd:documentation>
+                            </xsd:annotation>
+                        </xsd:attribute>
+                    </xsd:complexType>
+                </xsd:element>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
 
 	<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
 		Provider and Bus base types.
@@ -1781,24 +1819,6 @@
 			<xsd:complexContent>
 				<xsd:extension base="jesb:bus-provider">
                     <xsd:sequence>
-                        <xsd:element name="auth" minOccurs="0" maxOccurs="1">
-                            <xsd:complexType>
-                                <xsd:attribute name="method" use="optional" default="BASIC">
-                                    <xsd:simpleType>
-                                        <xsd:restriction base="xsd:NMTOKEN">
-                                            <xsd:enumeration value="BASIC" />
-                                            <xsd:enumeration value="DIGEST" />
-                                            <xsd:enumeration value="CLIENT-CERT" />
-                                        </xsd:restriction>
-                                    </xsd:simpleType>
-                                </xsd:attribute>
-                                <xsd:attribute name="domain" type="xsd:string" use="optional">
-                                    <xsd:annotation>
-                                        <xsd:documentation xml:lang="en">Security Domain.</xsd:documentation>
-                                    </xsd:annotation>
-                                </xsd:attribute>
-                            </xsd:complexType>
-                        </xsd:element>
                         <xsd:element name="exception" type="jesb:httpExceptionMappings" minOccurs="0" maxOccurs="1" />
                     </xsd:sequence>
                 </xsd:extension>

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -61,13 +61,6 @@
 
         // Map all config tree attributes as servlet parameters...
         servlet.getParams().addAll(webEndpointConfig.attributesAsList());
-
-        // Set the authentication method and domain.  Yes... this can result in the auth method/domain being set
-        // and reset by multiple listeners, but the auth method source config should be the
-        // same for them all.  Also, we throw an exception from inside the WebModel if an attempt
-        // is made to reset it to something else...
-        webModel.setAuthMethod(webEndpointConfig.getAttribute(AUTH_METHOD));
-        webModel.setAuthDomain(webEndpointConfig.getAttribute(AUTH_DOMAIN));
     }
 
     private void addSecurityConstraints(ConfigTree webEndpointConfig, Servlet servlet) {

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -485,6 +485,12 @@
         final List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>() ;
         WebDeploymentArchive webDeployment = new WebDeploymentArchive(getESBWarFileName(di));
         WebModel webModel = webDeployment.getWebModel();
+        
+        // Set the global security domain and global security method.
+        // These setting are shared for all http-providers and EBWSs 
+        // in a jboss-esb.xml file. 
+        webModel.setAuthDomain(model.getAuthDomain());
+        webModel.setAuthMethod(model.getAuthMethod());
 
         // Add the EBWS components...
         createWebserviceWars(di, model, deploymentName, publishers, webDeployment);

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -89,7 +89,6 @@
 
             List<HttpBus.ProtectedMethods> protectedMethodsList = bus.getProtectedMethodsList();
             List<HttpBus.AllowedRoles> rolesList = bus.getAllowedRolesList();
-            HttpProvider.Auth authType = provider.getAuth();
             HttpBus.TransportGuarantee.Enum transportGuarantee = bus.getTransportGuarantee();
 
             MapperUtil.mapProperties(bus.getPropertyList(), listenerNode);
@@ -119,10 +118,6 @@
                 }
                 listenerNode.setAttribute(HttpGatewayDeploymentFactory.ALLOWED_ROLES, rolesString.toString());
             }
-            if(authType != null) {
-                listenerNode.setAttribute(HttpGatewayDeploymentFactory.AUTH_METHOD, authType.getMethod().toString());
-                listenerNode.setAttribute(HttpGatewayDeploymentFactory.AUTH_DOMAIN, authType.getDomain());
-            }
 
             if(transportGuarantee != null) {
                 listenerNode.setAttribute(HttpGatewayDeploymentFactory.TRANSPORT_GUARANTEE, transportGuarantee.toString());

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -41,6 +41,8 @@
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.*;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.ActionsDocument.Actions;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.GlobalsDocument.Globals;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.GlobalsDocument.Globals.WarSecurity;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.JbossesbDocument.Jbossesb;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.PropertyDocument.Property;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.ProvidersDocument.Providers;
@@ -574,4 +576,34 @@
         }
         return endpointServices ;
     }
+    
+    public String getAuthDomain()
+    {
+        WarSecurity warSecurity = getWarSecurity();
+        if (warSecurity != null)
+        {
+	        return warSecurity.getDomain();
+        }
+        return null;
+    }
+    
+    public String getAuthMethod()
+    {
+        WarSecurity warSecurity = getWarSecurity();
+        if (warSecurity != null)
+        {
+            return warSecurity.getMethod().toString();
+        }
+        return null;
+    }
+
+    private WarSecurity getWarSecurity()
+    {
+        Globals globals = jbossesb.getGlobals();
+        if (globals != null)
+        {
+            return globals.getWarSecurity();
+        }
+        return null;
+    }
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model101SchemaParser.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -156,5 +156,23 @@
         {
             return model.getWebserviceServices() ;
         }
+
+        /**
+         * This feature in not implemented in the 1.0.1 version of the schema.
+         * @return null Since this feature is not implemented.
+         */
+        public String getAuthDomain()
+        {
+            return null;
+        }
+
+        /**
+         * This feature in not implemented in the 1.0.1 version of the schema.
+         * @return null Since this feature is not implemented.
+         */
+        public String getAuthMethod()
+        {
+            return null;
+        }
     }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model110SchemaParser.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -155,5 +155,23 @@
         {
             return model.getWebserviceServices() ;
         }
+
+        /**
+         * This feature in not implemented in the 1.0.1 version of the schema.
+         * @return null Since this feature is not implemented.
+         */
+        public String getAuthDomain()
+        {
+            return null;
+        }
+
+        /**
+         * This feature in not implemented in the 1.0.1 version of the schema.
+         * @return null Since this feature is not implemented.
+         */
+        public String getAuthMethod()
+        {
+            return null;
+        }
     }
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/Model120SchemaParser.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -154,5 +154,15 @@
         {
             return model.getWebserviceServices() ;
         }
+
+        public String getAuthDomain()
+        {
+            return model.getAuthDomain();
+        }
+
+        public String getAuthMethod()
+        {
+            return model.getAuthMethod();
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/model/ModelAdapter.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -79,4 +79,18 @@
      * @return The list of services.
      */
     public List<WebserviceInfo> getWebserviceServices() ;
+    
+    /**
+     * Gets the global authentication domain.
+     * 
+     * @return String The name of the authentication domain.
+     */
+    public String getAuthDomain() ;
+    
+    /**
+     * Gets the global authentication method.
+     * 
+     * @return String The name of the authentication method.
+     */
+    public String getAuthMethod() ;
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/EsbWebServiceDeployer.java	2009-09-30 11:46:48 UTC (rev 29513)
@@ -208,7 +208,14 @@
         }
 
         WebModel webModel = new WebModel(esbMetaData.getArchiveName());
+        
         try {
+	        // Set the global security domain and global security method.
+	        // These setting are shared for all http-providers and EBWSs 
+	        // in a jboss-esb.xml file. 
+	        webModel.setAuthDomain(esbMetaData.getModel().getAuthDomain());
+	        webModel.setAuthMethod(esbMetaData.getModel().getAuthMethod());
+	        
             ModelUtil.updateWebModel(ModelUtil.getListenerGroups(esbMetaData.getModel()), webModel);
         } catch (ConfigurationException e) {
             throw new DeploymentException("Failed to capture web metadata from ESB configuration.", e);

Modified: labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/build.xml	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/build.xml	2009-09-30 11:46:48 UTC (rev 29513)
@@ -14,7 +14,15 @@
         <echo>Http Client</echo>
         <java fork="yes" classname="org.jboss.soa.esb.actions.routing.http.HttpRouter" failonerror="true">
             <arg value="endpointUrl=http://localhost:8080/Quickstart_http_gateway/http/soap/"/>
+
+			<!-- The EBWS is secured with container level security -->
+            <arg value="configurators=HttpProtocol,AuthBASIC"/>
             <arg value="method=POST"/>
+            <arg value="auth-username=kermit"/>
+            <arg value="auth-password=thefrog"/>
+            <arg value="authscope-host=localhost"/>
+            <arg value="authscope-port=8080"/>
+			<!-- The actual payload to POST -->
             <arg value="payload=soap-login.xml"/>
             <classpath refid="exec-classpath"/>
         </java>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/jboss-esb.xml	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/jboss-esb.xml	2009-09-30 11:46:48 UTC (rev 29513)
@@ -1,7 +1,11 @@
 <?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"
-          parameterReloadSecs="5">
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
 
+	<globals>
+		<!-- Security setting for all http-providers and all EBWSs in this jboss-esb.xml file.
+		<war-security method="BASIC" domain="JBossWS" /> <!-- uname: "kermit" pw: "thefrog" -->
+	</globals>
+
     <providers>
         <http-provider name="http">
             <http-bus busid="secureFriends">
@@ -13,11 +17,10 @@
                 </allowed-roles>
                 <protected-methods>
                     <method name="GET" />
+                    <method name="POST" />
                 </protected-methods>
             </http-bus>
 
-            <auth method="BASIC" domain="JBossWS" /> <!-- uname: "kermit" pw: "thefrog" -->
-
             <!-- Global exception mappings file... -->
             <exception mappingsFile="/http-exception-mappings.properties" />
         </http-provider>
@@ -26,7 +29,6 @@
     <services>                                                  
 
         <service category="Sales" name="List" description="" invmScope="GLOBAL">
-            <security moduleName="JBossWS" />
             <listeners>
                 <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/sales/* but will be forced to
                                authenticate because the "sales" bus has basic auth configured (above)... -->
@@ -38,11 +40,12 @@
         </service>
 
         <service category="Soap" name="List" description="" invmScope="GLOBAL">
-            <security moduleName="JBossWS" />
             <listeners>
-                <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/soap/*
-                     Execute "ant soap" on command line.... -->
-                <http-gateway name="soap" urlPattern="soap/*">
+                <!-- 
+					Receives: http://<host>:<port>/Quickstart_http_gateway/http/soap/*
+                    Execute "ant soap" on command line.... 
+				-->
+                <http-gateway name="soap"  busidref="secureFriends" urlPattern="soap/*">
                     <exception>
                         <mapping class="org.jboss.soa.esb.services.security.SecurityServiceException" status="401" />
                     </exception>
@@ -106,4 +109,4 @@
 
     </services>
 
-</jbossesb>
\ No newline at end of file
+</jbossesb>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/soap-login.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/soap-login.xml	2009-09-30 09:47:22 UTC (rev 29512)
+++ labs/jbossesb/trunk/product/samples/quickstarts/http_gateway/soap-login.xml	2009-09-30 11:46:48 UTC (rev 29513)
@@ -3,15 +3,9 @@
 			xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
   <soap:Header>
-    <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
-      <wsse:UsernameToken>
-        <wsse:Username>kermit</wsse:Username>
-        <wsse:Password>thefrog</wsse:Password>
-      </wsse:UsernameToken>
-    </wsse:Security>
   </soap:Header>
 
   <soap:Body>
   </soap:Body>
 
-</soap:Envelope>
\ No newline at end of file
+</soap:Envelope>



More information about the jboss-svn-commits mailing list