[jboss-svn-commits] JBL Code SVN: r21284 - in labs/jbossesb/workspace/dbevenius/security/product: rosetta/src/org/jboss/soa/esb/listeners/gateway and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jul 29 15:55:11 EDT 2008


Author: beve
Date: 2008-07-29 15:55:11 -0400 (Tue, 29 Jul 2008)
New Revision: 21284

Added:
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/SecurityInfoExtractor.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/http/
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractor.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/User.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/SecurityContextUnitTest.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractorUnitTest.java
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/src/org/jboss/soa/esb/samples/quickstart/opensso/HttpClient.java
Removed:
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestBuilder.java
Modified:
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JaasSecurityService.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/SecurityContext.java
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/Group.java
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/build.xml
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbm-queue-service.xml
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbmq-queue-service.xml
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jboss-esb.xml
   labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/opensso.war
Log:
Added security extractor for jboss remoting http.(only username and password).


Modified: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JaasSecurityService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JaasSecurityService.java	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/internal/soa/esb/services/security/JaasSecurityService.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -39,6 +39,7 @@
 import org.jboss.soa.esb.services.security.SecurityService;
 import org.jboss.soa.esb.services.security.SecurityServiceException;
 import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.principals.Group;
 import org.jboss.soa.esb.services.security.principals.Role;
 import org.jboss.soa.esb.util.ClassUtil;
 
@@ -192,7 +193,9 @@
 		final String runAs = config.getRunAs();
 		if ( runAs != null )
 		{
-			subject.getPrincipals().add(new Role(runAs));
+			Group group = new Group("Roles");
+			group.addMember( new Role(runAs));
+			subject.getPrincipals().add(group);
 		}
 	}
 

Modified: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -49,6 +49,9 @@
 import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.services.registry.RegistryException;
 import org.jboss.soa.esb.services.registry.RegistryFactory;
+import org.jboss.soa.esb.services.security.SecurityService;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.http.JbrHttpSecurityInfoExtractor;
 import org.jboss.soa.esb.util.ClassUtil;
 
 import javax.management.MBeanServer;
@@ -497,7 +500,13 @@
 
             // Copy the request properties onto the message...
             Map properties = invocationRequest.getRequestPayload();
+            
+            
             if (properties != null) {
+                //	Extract any security information that exists
+                AuthenticationRequest authRequest = new JbrHttpSecurityInfoExtractor().extractSecurityInfo(properties);
+                message.getProperties().setProperty(SecurityService.AUTH_REQUEST, authRequest);
+                
                 // Purposely not iterating over the Map.Entry Set because there's
                 // a bug in the Map impl used by JBossRemoting.  Not all the
                 // "values" are actually in the Map.Entry set.  Some of them are handled

Modified: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/SecurityContext.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/SecurityContext.java	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/SecurityContext.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -20,8 +20,14 @@
  */
 package org.jboss.soa.esb.services.security;
 
+import static org.jboss.soa.esb.services.security.principals.Group.ROLES_GROUP_NAME;
 import java.io.Serializable;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.Set;
 
+
 import javax.security.auth.Subject;
 
 /**
@@ -63,5 +69,35 @@
 	{
 		return "SecurityContext [" + subject + "]";
 	}
-
+	
+	public boolean isCallerInRole( final String roleName )
+	{
+        Set<Principal> principals = subject.getPrincipals();
+        for(Principal principal: principals)
+        {
+            if(principal instanceof Group)
+            {
+                Group group = (Group) principal;
+                if( group.getName().equalsIgnoreCase( ROLES_GROUP_NAME ) )
+                {
+                    Enumeration<? extends Principal> roles = group.members();
+                    while(roles.hasMoreElements())
+                    {
+                        Principal role = roles.nextElement();
+                        if(role.getName().equals(roleName))
+                        {
+                            return true;
+                        }
+                    } 
+                }
+            }
+        }
+        return false;
+	}
+	
+	public Set<? extends Principal> getPrincipals()
+	{
+		return subject.getPrincipals();
+	}
+	
 }

Deleted: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestBuilder.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestBuilder.java	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/AuthenticationRequestBuilder.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -1,16 +0,0 @@
-package org.jboss.soa.esb.services.security.auth;
-
-
-public interface AuthenticationRequestBuilder
-{
-	/**
-	 * Create a instance of {@link AuthenticationRequestImpl}, populated
-	 * with security information contained in the message parameter.
-	 * 
-	 * @param message - The ESB Message object instance from which security properties should
-	 * 					be extracted
-	 * @return AuthenticationRequest 
-	 */
-	AuthenticationRequest buildRequest(final Object request);
-
-}

Added: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/SecurityInfoExtractor.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/SecurityInfoExtractor.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/SecurityInfoExtractor.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,6 @@
+package org.jboss.soa.esb.services.security.auth;
+
+public interface SecurityInfoExtractor<T>
+{
+	AuthenticationRequest extractSecurityInfo( final T t );
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractor.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractor.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractor.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.auth.http;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+import org.jboss.soa.esb.services.security.auth.SecurityInfoExtractor;
+import org.jboss.soa.esb.services.security.principals.User;
+
+/**
+ * 
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class JbrHttpSecurityInfoExtractor implements SecurityInfoExtractor<Map<String,Object>>
+{
+	private Logger log = Logger.getLogger(JbrHttpSecurityInfoExtractor.class);
+	
+	public static final String USERNAME_KEY = "http.basic.username";
+	public static final String PASSWORD_KEY = "http.basic.password";
+	
+	public AuthenticationRequest extractSecurityInfo( final Map<String,Object> request )
+	{
+		AuthenticationRequest authRequest = null;
+		String username = (String) request.get(USERNAME_KEY);
+		if ( username != null )
+		{
+			User user = new User((String)username);
+			Set<String> credentials = new HashSet<String>();
+			
+			String passwd = (String) request.get(PASSWORD_KEY);
+			if ( passwd != null )
+			{
+    			credentials.add(passwd);
+    			Object remove = request.remove(PASSWORD_KEY);
+    			if ( remove == null )
+    			{ 
+    				log.warn("Could not remove the password from the request map");
+    			}
+			}
+			
+			authRequest = new AuthenticationRequestImpl.Builder( user, credentials ).bulid();
+		}
+		return authRequest;
+	}
+
+}

Modified: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/Group.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/Group.java	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/Group.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -37,6 +37,8 @@
 public class Group implements java.security.acl.Group, Serializable
 {
 	private static final long serialVersionUID = 1L;
+	public static final String ROLES_GROUP_NAME = "Roles";
+	
 	private final String groupName;
 	private final Set<Principal> members = new HashSet<Principal>(); 
 

Added: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/User.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/User.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/principals/User.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.principals;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+/**
+ * Simple User
+ * <p/>
+ * 
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class User implements Principal, Serializable
+{
+	private static final long serialVersionUID = 1L;
+	private final String name;
+
+	public User(final String name)
+	{
+		if ( name == null )
+			throw new NullPointerException("name argument must not be null");
+		
+		this.name = name;
+	}
+
+	public String getName()
+	{
+		return name;
+	}
+	
+	public String toString()
+	{
+		return "User [roleName=" + name + "]";
+	}
+
+	@Override
+	public boolean equals(Object obj)
+	{
+		if (this == obj)
+			return true;
+		if(!(obj instanceof User))
+			return false;
+		
+		User other = (User) obj; 
+		return this.name.equals(other.name);
+	}
+
+	@Override
+	public int hashCode()
+	{
+		int hash = 17;
+		hash = 31 * hash + name == null ? 0 : name.hashCode();
+		return hash;
+	}
+
+}

Added: labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/SecurityContextUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/SecurityContextUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/SecurityContextUnitTest.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security;
+
+import static org.junit.Assert.*;
+
+import javax.security.auth.Subject;
+
+import org.jboss.soa.esb.services.security.principals.Group;
+import org.jboss.soa.esb.services.security.principals.Role;
+import org.jboss.soa.esb.services.security.principals.User;
+import org.junit.Test;
+
+import junit.framework.JUnit4TestAdapter;
+
+/**
+ * 
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class SecurityContextUnitTest
+{
+	@Test
+	public void isCallerInRole()
+	{
+		Subject subject = new Subject();
+		subject.getPrincipals().add( new User("AustinPowerwich") );
+		Group roles = new Group("Roles");
+		roles.addMember( new Role("Admin"));
+		subject.getPrincipals().add(roles);
+		
+		SecurityContext securityContext = new SecurityContext(subject);
+		boolean callerInRole = securityContext.isCallerInRole("Admin");
+		assertTrue( callerInRole );
+	}
+
+	public static junit.framework.Test suite()
+	{
+		return new JUnit4TestAdapter(SecurityContextUnitTest.class);
+	}
+}

Added: labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractorUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/http/JbrHttpSecurityInfoExtractorUnitTest.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.auth.http;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link JbrHttpSecurityInfoExtractor} 
+ * <p>
+ * 
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @since 4.4
+ */
+public class JbrHttpSecurityInfoExtractorUnitTest
+{
+	private String username = "Alf";
+	private String password = "Melmac";
+	
+	@Test
+	public void extractSecurityInfo()
+	{
+		Map<String,Object> metadata = createRequestMap(username, password);
+		
+		JbrHttpSecurityInfoExtractor extractor = new JbrHttpSecurityInfoExtractor();
+		AuthenticationRequest authRequest = extractor.extractSecurityInfo(metadata);
+		
+		assertNotNull(authRequest); 
+		assertEquals(username, authRequest.getPrincipal().getName());
+		assertEquals(password, authRequest.getCredentials().iterator().next());
+	}
+	
+	private Map<String,Object> createRequestMap(final String username, final String password)
+	{
+		Map<String,Object> metadata = new HashMap<String,Object>();
+        metadata.put("http.basic.username", username);
+        metadata.put("http.basic.password", password);
+        return metadata;
+	}
+	
+	public static junit.framework.Test suite()
+	{
+		return new JUnit4TestAdapter(JbrHttpSecurityInfoExtractorUnitTest.class);
+	}
+
+}

Modified: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/build.xml	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/build.xml	2008-07-29 19:55:11 UTC (rev 21284)
@@ -16,7 +16,7 @@
 	
 	<target name="runtest" depends="compile" 
 		description="sends a JMS message to queue/quickstart_opensso_Request_gw">
-		<echo>OpenSSO Login</echo>
+		<!--echo>OpenSSO Login</echo>
 		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.opensso.Login" failonerror="true">
 			<arg value="opensso"/>
 			<arg value="DataStore"/>
@@ -25,6 +25,15 @@
 			<arg value="${opensso.password}"/>
 			<classpath refid="exec-classpath"/>
 			<classpath path="${basedir}/lib"/>
+		</java-->
+		<echo>Http Client</echo>
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.opensso.HttpClient" failonerror="true">
+			<arg value="http"/>
+			<arg value="localhost"/>
+			<arg value="9888"/>
+			<arg value="${opensso.username}"/>
+			<arg value="${opensso.password}"/>
+			<classpath refid="exec-classpath"/>
 		</java>
 		<!--
 		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.opensso.test.SendJMSMessage" failonerror="true">

Modified: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbm-queue-service.xml	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbm-queue-service.xml	2008-07-29 19:55:11 UTC (rev 21284)
@@ -12,4 +12,11 @@
     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>
   </mbean>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_opensso_Request_esb_reply"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+
 </server>

Modified: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbmq-queue-service.xml	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jbmq-queue-service.xml	2008-07-29 19:55:11 UTC (rev 21284)
@@ -12,4 +12,10 @@
       jboss.mq:service=DestinationManager
     </depends>
   </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_opensso_Request_esb_reply">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
 </server>

Modified: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jboss-esb.xml	2008-07-29 17:43:58 UTC (rev 21283)
+++ labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/jboss-esb.xml	2008-07-29 19:55:11 UTC (rev 21284)
@@ -18,7 +18,7 @@
 
           </jms-provider>
 			<jbr-provider name="JBR-Http" protocol="http" host="localhost">
-				<jbr-bus busid="Http-1" port="9876" />
+				<jbr-bus busid="Http-1" port="9888" />
 			</jbr-provider>
       </providers>
 
@@ -32,7 +32,11 @@
             <listeners>
                 <jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" maxThreads="1" is-gateway="true" />
                 <jms-listener name="helloWorld" busidref="quickstartEsbChannel" maxThreads="1" />
-                <jbr-listener name="Http-Gateway" busidref="Http-1" is-gateway="true"/>
+
+                <jbr-listener name="Http-Gateway" busidref="Http-1" is-gateway="true">
+					<property name="synchronous" value="false"/>
+                </jbr-listener>
+
             </listeners>
 
             <actions mep="OneWay">

Modified: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/opensso.war
===================================================================
(Binary files differ)

Added: labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/src/org/jboss/soa/esb/samples/quickstart/opensso/HttpClient.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/src/org/jboss/soa/esb/samples/quickstart/opensso/HttpClient.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/security/product/samples/quickstarts/opensso/src/org/jboss/soa/esb/samples/quickstart/opensso/HttpClient.java	2008-07-29 19:55:11 UTC (rev 21284)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.samples.quickstart.opensso;
+
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class HttpClient
+{
+   // Default locator values
+   private static String transport = "http";
+   private static String host = "localhost";
+   private static int port = 5400;
+   private static String username;
+   private static String password;
+
+   public void makeInvocation(String locatorURI) throws Throwable
+   {
+      InvokerLocator locator = new InvokerLocator(locatorURI);
+      System.out.println("Calling remoting server with locator uri of: " + locatorURI);
+
+      Client remotingClient = new Client(locator);
+      remotingClient.connect();
+
+      Map metadata = new HashMap();
+      metadata.put("TYPE", "POST");
+      metadata.put("http.basic.username", username);
+      metadata.put("http.basic.password", password);
+      remotingClient.invokeOneway( "testing", metadata );
+
+      System.out.println("Sent http post to server.");
+      Integer responseCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+      String responseMessage = (String) metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+      System.out.println("Response code from server: " + responseCode);
+      System.out.println("Response message from server: " + responseMessage);
+      remotingClient.disconnect();
+
+   }
+
+   public static void main(String[] args)
+   {
+      if(args != null && args.length == 5)
+      {
+         transport = args[0];
+         host = args[1];
+         port = Integer.parseInt(args[2]);
+         username = args[3];
+         password = args[4];
+      }
+      String locatorURI = transport + "://" + host + ":" + port;
+      HttpClient client = new HttpClient();
+      try
+      {
+         client.makeInvocation(locatorURI);
+      }
+      catch(Throwable e)
+      {
+         e.printStackTrace();
+      }
+   }
+}
+




More information about the jboss-svn-commits mailing list