[jboss-cvs] JBossAS SVN: r108276 - in branches/JBPAPP_5_1/iiop/src/main/org/jboss: iiop/csiv2 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 21 23:15:21 EDT 2010
Author: sguilhen at redhat.com
Date: 2010-09-21 23:15:21 -0400 (Tue, 21 Sep 2010)
New Revision: 108276
Added:
branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/IORSecurityConfigUtil.java
Modified:
branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBService.java
branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java
branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/csiv2/CSIv2IORInterceptor.java
branches/JBPAPP_5_1/iiop/src/main/org/jboss/proxy/ejb/IORFactory.java
Log:
JBAS-8169: default IOR security settings can now be specified in CorbaORBService. These settings are applied to all IORs created by JBAS and can be overridden by the ior-security-config settings in jboss.xml
Modified: branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBService.java
===================================================================
--- branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBService.java 2010-09-22 03:13:35 UTC (rev 108275)
+++ branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBService.java 2010-09-22 03:15:21 UTC (rev 108276)
@@ -35,7 +35,9 @@
import org.jboss.bootstrap.spi.util.ServerConfigUtil;
import org.jboss.iiop.naming.ORBInitialContextFactory;
+import org.jboss.metadata.IorSecurityConfigMetaData;
import org.jboss.metadata.MetaData;
+import org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData;
import org.jboss.proxy.ejb.handle.HandleDelegateImpl;
import org.jboss.security.SecurityDomain;
import org.jboss.system.Registry;
@@ -79,6 +81,7 @@
private String orbSingletonDelegate = null;
private String orbPropertiesFileName = "orb-properties-file-not-defined";
private Element portableInterceptorInitializers = null;
+ private Element defaultIORSecurityConfig = null;
private int port = 0;
private int sslPort = 0;
private String sslDomain = null;
@@ -113,6 +116,22 @@
private static boolean sendSasAcceptWithExceptionEnabledFlag = true;
/**
+ * Default IOR security metadata. Can be overriden by settings specified
+ * in the jboss.xml file.
+ */
+ private static IorSecurityConfigMetaData defaultIORSecurityMetaData = new IorSecurityConfigMetaData();
+
+ /**
+ * Returns the default IOR security metadata. This method is intended to
+ * be called by the CSIv2 IOR interceptor, which needs to know the default
+ * CSIv2 settings when creating the CSIv2 IOR components.
+ */
+ public static IorSecurityConfigMetaData getDefaultIORSecurityMetaData()
+ {
+ return defaultIORSecurityMetaData;
+ }
+
+ /**
* True if the OTS context should be sent along with outgoing requests.
*/
private static boolean otsContextPropagationEnabledFlag = false;
@@ -241,6 +260,17 @@
System.setProperties(systemProps);
+ // Create the default IOR security configuration
+ if (this.defaultIORSecurityConfig != null)
+ {
+ if ("ior-security-config".equals(this.defaultIORSecurityConfig.getNodeName()))
+ defaultIORSecurityMetaData = IORSecurityConfigUtil.parseIorSecurityConfigMetaData(
+ this.defaultIORSecurityConfig);
+ else
+ log.warn("Ignoring default IOR security config - invalid element: expected ior-security-config but found " +
+ this.defaultIORSecurityConfig.getNodeName());
+ }
+
// Add portable interceptor initializers
Iterator initializerElements =
MetaData.getChildrenByTagName(portableInterceptorInitializers,
@@ -470,6 +500,16 @@
this.portableInterceptorInitializers = portableInterceptorInitializers;
}
+ public Element getDefaultIORSecurityConfig()
+ {
+ return this.defaultIORSecurityConfig;
+ }
+
+ public void setDefaultIORSecurityConfig(Element defaultIORSecurityConfig)
+ {
+ this.defaultIORSecurityConfig = defaultIORSecurityConfig;
+ }
+
public void setPort(int port)
{
this.port = port;
Modified: branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java
===================================================================
--- branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java 2010-09-22 03:13:35 UTC (rev 108275)
+++ branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java 2010-09-22 03:15:21 UTC (rev 108276)
@@ -55,6 +55,9 @@
public void setPortableInterceptorInitializers(
Element portableInterceptorInitializers);
+ public Element getDefaultIORSecurityConfig();
+ public void setDefaultIORSecurityConfig(Element defaultIORSecurityConfig);
+
public void setPort(int port);
public int getPort();
Added: branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/IORSecurityConfigUtil.java
===================================================================
--- branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/IORSecurityConfigUtil.java (rev 0)
+++ branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/IORSecurityConfigUtil.java 2010-09-22 03:15:21 UTC (rev 108276)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.iiop;
+
+import org.jboss.metadata.IorSecurityConfigMetaData;
+import org.jboss.metadata.MetaData;
+import org.w3c.dom.Element;
+
+/**
+ * <p>
+ * Utility class that creates {@code IorSecurityConfigMetaData} by parsing a XML configuration that contains
+ * the IOR security settings.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public class IORSecurityConfigUtil
+{
+
+ /**
+ * <p>
+ * Parses the specified XML element and creates an instance of {@code IorSecurityConfigMetaData} with the data
+ * that has been extracted from the XML.
+ * </p>
+ *
+ * @param element the {@code Element} that contains the IOR security configuration.
+ * @return the constructed {@code IorSecurityConfigMetaData} instance.
+ */
+ public static IorSecurityConfigMetaData parseIorSecurityConfigMetaData(Element element)
+ {
+ IorSecurityConfigMetaData metadata = new IorSecurityConfigMetaData();
+
+ // parse the transport configuration.
+ Element child = MetaData.getOptionalChild(element, "transport-config");
+ if (child != null)
+ {
+ String integrity = MetaData.getUniqueChildContent(child, "integrity");
+ String confidentiality = MetaData.getUniqueChildContent(child, "confidentiality");
+ String establishTrustInTarget = MetaData.getUniqueChildContent(child, "establish-trust-in-target");
+ String establishTrustInClient = MetaData.getUniqueChildContent(child, "establish-trust-in-client");
+ String detectMisordering = MetaData.getOptionalChildContent(child, "detect-misordering");
+ String detectReplay = MetaData.getOptionalChildContent(child, "detect-replay");
+ metadata.setTransportConfig(metadata.new TransportConfig(integrity, confidentiality,
+ establishTrustInTarget, establishTrustInClient, detectMisordering, detectReplay));
+ }
+ else
+ throw new IllegalArgumentException("The IOR transport config cannot be null");
+
+ // parse the authentication service configuration.
+ child = MetaData.getOptionalChild(element, "as-context");
+ if (child != null)
+ {
+ String authMethod = MetaData.getUniqueChildContent(child, "auth-method");
+ String realm = MetaData.getUniqueChildContent(child, "realm");
+ boolean required = Boolean.parseBoolean(MetaData.getUniqueChildContent(child, "required"));
+ metadata.setAsContext(metadata.new AsContext(authMethod, realm, required));
+ }
+ else
+ throw new IllegalArgumentException("The IOR AS context config cannot be null");
+
+ // parse the security attribute service configuration.
+ child = MetaData.getOptionalChild(element, "sas-context");
+ if (child != null)
+ {
+ String callerPropagation = MetaData.getUniqueChildContent(child, "caller-propagation");
+ metadata.setSasContext(metadata.new SasContext(callerPropagation));
+ }
+ else
+ throw new IllegalArgumentException("The IOR SAS context config cannot be null");
+
+ return metadata;
+ }
+}
\ No newline at end of file
Modified: branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/csiv2/CSIv2IORInterceptor.java
===================================================================
--- branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/csiv2/CSIv2IORInterceptor.java 2010-09-22 03:13:35 UTC (rev 108275)
+++ branches/JBPAPP_5_1/iiop/src/main/org/jboss/iiop/csiv2/CSIv2IORInterceptor.java 2010-09-22 03:15:21 UTC (rev 108276)
@@ -83,7 +83,7 @@
defaultSSLComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value,
componentData);
- IorSecurityConfigMetaData metadata = new IorSecurityConfigMetaData();
+ IorSecurityConfigMetaData metadata = CorbaORBService.getDefaultIORSecurityMetaData();
defaultCSIComponent = CSIv2Util.createSecurityTaggedComponent(metadata,
codec, sslPort, orb);
}
Modified: branches/JBPAPP_5_1/iiop/src/main/org/jboss/proxy/ejb/IORFactory.java
===================================================================
--- branches/JBPAPP_5_1/iiop/src/main/org/jboss/proxy/ejb/IORFactory.java 2010-09-22 03:13:35 UTC (rev 108275)
+++ branches/JBPAPP_5_1/iiop/src/main/org/jboss/proxy/ejb/IORFactory.java 2010-09-22 03:15:21 UTC (rev 108276)
@@ -391,6 +391,8 @@
Any secPolicy = orb.create_any();
IorSecurityConfigMetaData iorSecurityConfigMetaData =
container.getBeanMetaData().getIorSecurityConfigMetaData();
+ if (iorSecurityConfigMetaData == null)
+ iorSecurityConfigMetaData = CorbaORBService.getDefaultIORSecurityMetaData();
secPolicy.insert_Value(iorSecurityConfigMetaData);
csiv2Policy = orb.create_policy(CSIv2Policy.TYPE, secPolicy);
More information about the jboss-cvs-commits
mailing list