[jboss-svn-commits] JBL Code SVN: r23318 - in labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic: src/org/jboss/soa/esb/samples/quickstart/securitybasic and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 6 04:40:40 EDT 2008
Author: beve
Date: 2008-10-06 04:40:38 -0400 (Mon, 06 Oct 2008)
New Revision: 23318
Added:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/HttpClient.java
Removed:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/HttpClient.java
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/build.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/jboss-esb.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/readme.txt
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2091 "quickstart: security_basic - poor readme.txt, misplaced HttpClient.java"
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/build.xml 2008-10-06 06:43:26 UTC (rev 23317)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/build.xml 2008-10-06 08:40:38 UTC (rev 23318)
@@ -14,7 +14,7 @@
<target name="runtest" depends="compile"
description="sends a HTTP request to the JBossRemoting gateway">
<echo>Http Client</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitybasic.HttpClient" failonerror="true">
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.securitybasic.test.HttpClient" failonerror="true">
<arg value="http"/>
<arg value="localhost"/>
<arg value="9888"/>
@@ -30,8 +30,8 @@
<arg value="Security"/> <!-- service category -->
<arg value="SimpleListenerSecured"/> <!-- service name -->
<arg value="Hello Secured World"/> <!-- Message text -->
- <arg value="esbuser"/> <!-- username text -->
- <arg value="esbpassword"/> <!-- password text -->
+ <arg value="${username}"/> <!-- username text -->
+ <arg value="${password}"/> <!-- password text -->
<classpath refid="exec-classpath"/>
</java>
</target>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/jboss-esb.xml 2008-10-06 06:43:26 UTC (rev 23317)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/jboss-esb.xml 2008-10-06 08:40:38 UTC (rev 23318)
@@ -63,30 +63,12 @@
<property name="printfull" value="false"/>
<property name="message" value="In Service2"/>
</action>
+
<action name="action2" class="org.jboss.soa.esb.samples.quickstart.securitybasic.MyListenerAction" process="displayMessage"/>
- <!-- Route to the "Service 3"
- <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
- <property name="destinations">
- <route-to service-category="Security" service-name="Service3"/>
- </property>
- </action> -->
</actions>
</service>
- <service category="Security" name="Service3" description="Service 3" invmScope="GLOBAL">
- <security moduleName="messaging" runAs="adminRole"/>
- <actions mep="OneWay">
-
- <action name="propagate" class="org.jboss.soa.esb.services.security.actions.JBossSecurityPropagator">
- <property name="runAs" value="adminRole"/>
- </action>
-
- </actions>
-
- </service>
-
-
</services>
</jbossesb>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/readme.txt
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/readme.txt 2008-10-06 06:43:26 UTC (rev 23317)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/readme.txt 2008-10-06 08:40:38 UTC (rev 23318)
@@ -1,9 +1,11 @@
Overview:
=========
- This quickstart demonstrates basic security in JBossESB.
- 1. 'ant runtest' will send a HTTP request to a JBossRemoting Gatway
- 2. 'ant sendesb' will invoke the Service directly using the ServiceInvoker
-
+ This quickstart demonstrates basic security in JBossESB. The following will be demonstrated by this quickstart:
+ * Per service authentication configuration
+ * Configuring the roles allowed to execute the service
+ * Invoking a service via a gateway
+ * Invoking a service directly (using the ServiceInvoker)
+
Running this quickstart:
========================
Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
@@ -12,9 +14,30 @@
To Run '.esb' archive mode with JBossAS-server:
===========================
1. Type 'ant deploy'.
- 2. Type 'ant runtest'
- 3. Type 'ant sendesb'
+ 2. 'ant runtest' will send a HTTP request to a JBossRemoting Gatway
+ 2. 'ant sendesb' will invoke the Service directly using the ServiceInvoker
What to look for in this quickstart
===================================
+ # Security configuration
+ <service category="Security" name="SimpleListenerSecured" description="Hello World">
+ <security moduleName="messaging" rolesAllowed="esbrole"/>
+ The security element declares that this service requires authentication to be executed and that the
+ authenticated users be a member in the role 'esbrole'. The role is determined by the JAAS login
+ module being used, in this case by the 'messaging' module specified in login-config.xml.
+ # src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/HttpClient.java
+ This is a JBossRemoting client that uses http to invoke the JBossRemoting gateway.
+
+ # src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/SendEsbMessage.java
+ This class uses the ServiceInvoker to invoke the ESB service directly, by-passing the gateway.
+ You can see how an AuthenticationRequest is created then encrypted, and passed to the ESB
+ by attaching the authentication request to the ESB Message object.
+
+ # src/org/jboss/soa/esb/samples/quickstart/securitybasic/MyListenerAction.java
+ This ESB Action show how the currently autenticated JAAS Subject can be accessed:
+ System.out.println("Subject in MyListenerAction : " + Subject.getSubject(AccessController.getContext()));
+
+ # Please refer to the "Security" section of the ServiceGuide.pdf for more details on the security features of JBossESB.
+
+
Deleted: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/HttpClient.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/HttpClient.java 2008-10-06 06:43:26 UTC (rev 23317)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/HttpClient.java 2008-10-06 08:40:38 UTC (rev 23318)
@@ -1,84 +0,0 @@
-/*
- * 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.securitybasic;
-
-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( "Message payload example(just a String) ", 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();
- }
- }
-}
-
Copied: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/HttpClient.java (from rev 23317, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/HttpClient.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/HttpClient.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/security_basic/src/org/jboss/soa/esb/samples/quickstart/securitybasic/test/HttpClient.java 2008-10-06 08:40:38 UTC (rev 23318)
@@ -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.securitybasic.test;
+
+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( "Message payload example(just a String) ", 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