Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 18 files changed
  • 0 commit comments
  • 1 contributor
View
2  README.md
@@ -43,7 +43,7 @@ This example shows how the property order can be wrong using CXF if you have pro
###Simple Logging Handler
-This project installs a simple java.util.logging.Handler into JBoss. The handler esentially duplicates all log messages to `STDOUT`. All custom handlers need to call `isLoggable()` to check the logging level and also need to use its formatter to format each message. Examine `standalone-changes.diff` if you want to see the changes necessary to install the custom logger in JBoss.
+This project installs a simple `java.util.logging.Handler` into JBoss. The handler esentially duplicates all log messages to `STDOUT`. All custom handlers need to call `isLoggable()` to check the logging level and also need to use its formatter to format each message. Examine `standalone-changes.diff` if you want to see the changes necessary to install the custom logger in JBoss.
To build and deploy this example, run `./installHandler.sh`, which will run ant, create the module, and make the changes to `standalone.xml`. The diff assumes the `standalone.xml` has been unmodified from the stock version of EAP 6.
View
0  cxfWssX509EjbEap5.jar/META-INF/MANIFEST.MF
No changes.
View
BIN  cxfWssX509EjbEap5.jar/META-INF/alice.jks
Binary file not shown
View
5 cxfWssX509EjbEap5.jar/META-INF/alice.properties
@@ -0,0 +1,5 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=password
+org.apache.ws.security.crypto.merlin.keystore.alias=alice
+org.apache.ws.security.crypto.merlin.file=META-INF/alice.jks
View
BIN  cxfWssX509EjbEap5.jar/META-INF/bob.jks
Binary file not shown
View
5 cxfWssX509EjbEap5.jar/META-INF/bob.properties
@@ -0,0 +1,5 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=password
+org.apache.ws.security.crypto.merlin.keystore.alias=bob
+org.apache.ws.security.crypto.merlin.file=META-INF/bob.jks
View
7 cxfWssX509EjbEap5.jar/META-INF/jboss.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
+
+<jboss>
+ <security-domain>java:/jaas/JBossWS</security-domain>
+</jboss>
View
36 cxfWssX509EjbEap5.jar/META-INF/jbossws-cxf.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+ <bean id="Sign_Request" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Timestamp Signature"/>
+ <entry key="signaturePropFile" value="META-INF/bob.properties"/>
+ <entry key="passwordCallbackClass" value="com.redhat.gss.wsse.KeystorePasswordCallback"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ <bean id="Sign_Response" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Timestamp Signature"/>
+ <entry key="user" value="bob"/>
+ <entry key="signaturePropFile" value="META-INF/bob.properties"/>
+ <entry key="signatureKeyIdentifier" value="DirectReference"/>
+ <entry key="passwordCallbackClass" value="com.redhat.gss.wsse.KeystorePasswordCallback"/>
+ <entry key="signatureParts" value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ <jaxws:endpoint id="ServiceImpl" address="http://@jboss.bind.address@:8080/cxfWssX509EjbEap5/ServiceImpl" implementor="com.redhat.gss.wsse.ServiceImpl">
+ <jaxws:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
+ <ref bean="Sign_Response"/>
+ </jaxws:outInterceptors>
+ <jaxws:inInterceptors>
+ <ref bean="Sign_Request"/>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
+ </jaxws:inInterceptors>
+ </jaxws:endpoint>
+</beans>
View
41 cxfWssX509EjbEap5.jar/META-INF/wsdl/SecurityService.wsdl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<definitions targetNamespace="http://www.jboss.org/jbossws/ws-extensions/wssecurity" name="SecurityService"
+ xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/wssecurity"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://www.jboss.org/jbossws/ws-extensions/wssecurity" schemaLocation="SecurityService_schema1.xsd"/>
+ </xsd:schema>
+ </types>
+ <message name="sayHello">
+ <part name="parameters" element="tns:sayHello"/>
+ </message>
+ <message name="sayHelloResponse">
+ <part name="parameters" element="tns:sayHelloResponse"/>
+ </message>
+ <portType name="ServiceIface">
+ <operation name="sayHello">
+ <input message="tns:sayHello"/>
+ <output message="tns:sayHelloResponse"/>
+ </operation>
+ </portType>
+ <binding name="SecurityServicePortBinding" type="tns:ServiceIface">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="sayHello">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="SecurityService">
+ <port name="SecurityServicePort" binding="tns:SecurityServicePortBinding">
+ <soap:address location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-sign"/>
+ </port>
+ </service>
+</definitions>
View
18 cxfWssX509EjbEap5.jar/META-INF/wsdl/SecurityService_schema1.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://www.jboss.org/jbossws/ws-extensions/wssecurity" xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/wssecurity" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="sayHello" type="tns:sayHello"/>
+
+ <xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
+
+ <xs:complexType name="sayHello">
+ <xs:sequence/>
+ </xs:complexType>
+
+ <xs:complexType name="sayHelloResponse">
+ <xs:sequence>
+ <xs:element name="return" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+
View
3  cxfWssX509EjbEap5.jar/README.md
@@ -0,0 +1,3 @@
+###X509 WS-Security Example for CXF in EAP 5
+
+This is an example of how to set up WS-Security X509 profile. The client signs the message using alice's private key (via the WSS4J action `Timestamp Signature`), and the endpoint verifies the signature. The endpoint also signs the response using bob's key, and the client verifies. `ant deploy` to build and deploy and `ant test` to run the test client.
View
2  cxfWssX509EjbEap5.jar/build.properties
@@ -0,0 +1,2 @@
+test-client=com.redhat.gss.wsse.SignTest
+auth-conf=${basedir}/auth.conf
View
722 cxfWssX509EjbEap5.jar/build.xml
@@ -0,0 +1,722 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+author: Brad Maxwell
+Simplified Build
+version 0.4 May 28, 2010
+Added Help
+Adding custom lib directory in build.properties
+-->
+
+<project name="simplified-build" default="all">
+ <!-- ===== PROPERTIES ===== -->
+ <property environment="env"/>
+ <!-- <basename property="dirName" file="${env.PWD}"/> -->
+ <!-- <dirname property="script-dir" file="${ant.file.main}"/> --> <!-- same as env.BUILD_SCRIPTS -->
+
+ <basename property="dirName" file="${basedir}"/>
+
+ <!-- <available property="unified-build-exists" file="${basedir}/unified-build.xml" value="true"/> -->
+ <property name="parentDir" location="${basedir}/.."/>
+
+ <property file="build.properties"/> <!-- Include build.properties -->
+
+ <!-- environment variables that need to be set -->
+ <condition property="jboss-home" value="${JBOSS_HOME}" else="${env.JBOSS_HOME}"><isset property="JBOSS_HOME"/></condition>
+
+ <!-- init method will verify they are set -->
+
+ <!-- AS7 / EAP6 -->
+ <available file="${jboss-home}/modules" property="AS7"/>
+
+ <!-- use default if env.JBOSS_PROFILE is not set and not specified in build.properties -->
+ <condition property="JBOSS_PROFILE" value="standalone" else="default"><isset property="AS7"/></condition>
+
+ <!-- <condition property="jboss-server" value="${JBOSS_PROFILE}" else="${env.JBOSS_PROFILE}"><isset property="JBOSS_PROFILE"/></condition> -->
+ <condition property="jboss-server" value="${env.JBOSS_PROFILE}" else="${JBOSS_PROFILE}"><isset property="env.JBOSS_PROFILE"/></condition>
+
+
+ <condition property="jboss-server-dir" value="${jboss-home}/${jboss-server}" else="${jboss-home}/server/${jboss-server}"><isset property="AS7"/></condition>
+
+ <condition property="jboss-deploy-dir" value="${jboss-server-dir}/deployments/" else="${jboss-server-dir}/deploy/"><isset property="AS7"/></condition>
+ <!-- <property name="jboss-endorsed-dir" location="${jboss-home}/lib/endorsed/"/> -->
+
+ <condition property="lib" value="${jboss-home}/modules/" else="${jboss-server-dir}/lib"><isset property="AS7"/></condition>
+ <property name="ant.project.name" value="${dirName}" />
+ <property name="archive.name" value="${dirName}" />
+ <property name="dist" value="dist"/>
+
+ <condition property="debuglevel" value="${debuglevel}" else="lines,vars,source"><isset property="debuglevel"/></condition>
+ <condition property="debug" value="${debug}" else="on"><isset property="debug"/></condition>
+
+ <!-- can set property, then use condition value="", if condition is not satisfied, it will not change the property -->
+
+ <!-- ===== ARCHIVE-TYPE ===== -->
+ <condition property="archive-type" value="jar"><matches string="${dirName}" pattern="^.*\.jar$"/></condition>
+ <condition property="archive-type" value="sar"><matches string="${dirName}" pattern="^.*\.sar$"/></condition>
+ <condition property="archive-type" value="war"><matches string="${dirName}" pattern="^.*\.war$"/></condition>
+ <condition property="archive-type" value="ear"><matches string="${dirName}" pattern="^.*\.ear$"/></condition>
+ <condition property="archive-type" value="aop"><matches string="${dirName}" pattern="^.*\.aop$"/></condition>
+ <condition property="archive-type" value="beans"><matches string="${dirName}" pattern="^.*\.beans$"/></condition>
+
+ <!-- this is the name of the ear/war/jar/... without the extension -->
+ <basename property="archive-name" file="${basedir}" suffix=".${archive-type}"/>
+
+ <!-- this property checks to see if it is an ear, and if so it will prevent the build target being called on the ear -->
+ <condition property="build" value="true">
+ <not><matches string="${archive-type}" pattern="ear"/></not>
+ </condition>
+
+ <!-- used to determine if ear needs to be packaged -->
+ <condition property="ear" value="true">
+ <matches string="${archive-type}" pattern="ear"/>
+ </condition>
+
+<!--
+ <condition property="manifest-class-path" value=""><not><isset property="manifest-class-path"/></not></condition>
+-->
+ <condition property="main-class" value=""><not><isset property="main-class"/></not></condition>
+
+ <condition property="earLib" value="${parentDir}/lib/" else="">
+ <and>
+ <matches string="${parentDir}" pattern="^.*\.ear$"/>
+ <available file="${parentDir}/lib" type="dir"/>
+ </and>
+ </condition>
+
+ <condition property="apiJarEarLib" value="../" else="">
+ <!-- for api-jar in lib dir -->
+ <and>
+ <!-- <matches string="${parentDir}" pattern="^.*/lib$"/> --> <!-- TODO this doesn't work on win -->
+ <matches string="${dirName}" pattern="^.*-api.jar$"/>
+ </and>
+ </condition>
+
+ <condition property="buildPath" value="WEB-INF/classes" else="">
+ <matches string="${archive-type}" pattern="^war$"/>
+ </condition>
+ <condition property="buildPath" value="" else=".">
+ <matches string="${archive-type}" pattern="^ear$"/>
+ </condition>
+
+ <!-- this should be . if in ear or .. if in sub dir -->
+ <condition property="ear-sub-archives-dir" value="." else="..">
+ <matches string="${archive-type}" pattern="^ear$"/>
+ </condition>
+ <condition property="ear-lib-dir" value="./lib" else="../lib">
+ <matches string="${archive-type}" pattern="^ear$"/>
+ </condition>
+
+ <condition property="include-build-classpath" value="">
+ <not><isset property="include-build-classpath"/></not>
+ </condition>
+
+ <!-- ===== PATHS / SETS ===== -->
+
+ <fileset dir="${basedir}" id="war.package.fileset">
+ <exclude name="**/*.java"/>
+ <exclude name="dist/"/>
+ <exclude name="build.xml"/>
+ <exclude name="build.properties"/>
+ <exclude name=".*"/>
+ </fileset>
+
+ <fileset dir="${basedir}" id="jar.package.fileset">
+ <exclude name="**/*.java"/>
+ <exclude name="bin/"/>
+ <exclude name="dist/"/>
+ <exclude name="build.xml"/>
+ <exclude name="build.properties"/>
+ </fileset>
+
+ <path id="classpath">
+ <!-- <path refid="user-classpath"/> -->
+ <pathelement location="${buildPath}" />
+
+ <fileset dir="${include-build-classpath}" includes="**/*.jar"/>
+
+ <dirset dir="${earLib}">
+ <include name="*-api.jar"/>
+ </dirset>
+
+ <!-- include jar,sar,war buildpaths in classpath -->
+ <dirset dir="${ear-sub-archives-dir}">
+ <include name="*.jar"/>
+ <include name="*.sar"/>
+ <include name="*.war/WEB-INF/classes"/>
+ </dirset>
+
+<!-- duplicate
+ <fileset dir="${ear-sub-archives-dir}">
+ <include name="*.jar"/>
+ </fileset>
+-->
+
+ <fileset dir="${jboss-home}/" includes="common/lib/**/*.jar"/> <!-- eap 5 -->
+ <fileset dir="${jboss-home}/" includes="lib/**/*.jar"/>
+ <fileset dir="${jboss-home}/" includes="client/**/*.jar"/>
+ <fileset dir="${jboss-server-dir}/" includes="lib/**/*.jar"/>
+ <fileset dir="${jboss-deploy-dir}/" includes="**/jsf*.jar"/>
+ <fileset dir="${jboss-deploy-dir}/" includes="**/portal-*.jar"/>
+ <fileset dir="${jboss-deploy-dir}/" includes="**/portlet-*.jar"/>
+ <fileset dir="${jboss-deploy-dir}/" includes="*jboss-portal*/**/*.jar"/>
+ <fileset dir="${jboss-deploy-dir}/" includes="*ejb3.deployer*/**/*.jar"/>
+ <fileset dir="${jboss-server-dir}/" includes="deployers/**/*.jar"/>
+
+ <!-- if parent dir is an EAR and contains a lib dir then add to classpath -->
+ <fileset dir="${earLib}">
+ <type type="file"/>
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="${apiJarEarLib}">
+ <include name="**/*.jar"/>
+ </fileset>
+
+ <!-- add support for lib declared in build.properties -->
+ <fileset dir="${lib}">
+ <include name="**/*.jar"/>
+ </fileset>
+
+ </path>
+
+ <!-- =============================== -->
+ <path id="ordered-dirs">
+ <fileset dir="${basedir}" includes="lib/*-api.jar/build.xml" id="lib-api-dirs"/>
+ <fileset dir="${basedir}" includes="lib/*.jar/build.xml" excludes="*-api.jar/build.xml" id="lib-api-dirs2"/>
+ <fileset dir="${basedir}" includes="*-api.jar/build.xml" id="api-dirs"/>
+ <fileset dir="${basedir}" includes="*.jar/build.xml" id="jar-dirs">
+ <and>
+ <filename name="*.jar/build.xml"/>
+ <filename name="*-api.jar/build.xml" negate="true"/>
+ <filename name="*-ejb.jar/build.xml" negate="true"/>
+ </and>
+ </fileset>
+ <fileset dir="${basedir}" includes="*.sar/build.xml" id="sar-dirs"/>
+ <fileset dir="${basedir}" includes="*-ejb.jar/build.xml" id="ejb-dirs"/>
+ <fileset dir="${basedir}" includes="*.aop/build.xml" id="aop-dirs"/>
+ <fileset dir="${basedir}" includes="*.war/build.xml" id="war-dirs"/>
+ </path>
+
+<!-- =============================== -->
+
+ <!-- ===== MACRODEFS ===== -->
+ <macrodef name="iterate">
+ <attribute name="target"/>
+ <sequential>
+ <subant target="@{target}" inheritall="false" inheritrefs="false" verbose="false">
+ <!-- <reference refid="user-classpath" torefid="user-classpath"/> -->
+ <property name="caller" location="."/>
+ <property name="main.build" location="${ant.file.main}"/>
+ <path refid="ordered-dirs"/>
+ </subant>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="check-env-set">
+ <attribute name="var"/>
+ <sequential>
+ <fail message="Please set the environment variable @{var}" unless="@{var}"/>
+ </sequential>
+ </macrodef>
+
+
+ <!-- ===== TARGETS ===== -->
+
+ <!-- [SB2] requires inits for everything -->
+ <!-- BEGIN OF INITS -->
+ <!-- this property will allow only *-init methods needed to be created, all other will direct to jar-init -->
+ <condition property="init-type" value="jar" else="${archive-type}"><not><matches string="${archive-type}" pattern="^[ew]ar$"/></not></condition>
+
+ <macrodef name="init">
+ <sequential>
+ <check-env-set var="env.JBOSS_HOME"/>
+ <check-env-set var="jboss-server"/>
+
+ <echo>Running ${archive-type} build scripts : ${ant.file}</echo>
+ <fail message="Unable to build ${dirName}. It should be a jar, war, ear, ..."
+ unless="archive-type"/>
+
+ <antcall target="${init-type}-init"/>
+ </sequential>
+ </macrodef>
+
+ <target name="ear-init">
+ <!-- [SB1] - create ear's META-INF & lib & touch application.xml if it does not exist -->
+ <!-- moved to ear-init instead of package, because war build requires war-init to be called before packaging & all builds use jar build now -->
+ <mkdir dir="${basedir}/META-INF/"/>
+ <mkdir dir="${basedir}/lib/"/>
+ <touch file="${basedir}/META-INF/application.xml"/>
+ </target>
+
+ <target name="jar-init">
+ <mkdir dir="${basedir}/META-INF/"/>
+ <touch file="${basedir}/META-INF/MANIFEST.MF"/>
+ </target>
+
+ <target name="war-init">
+ <!-- [SB2] - create WEB-INF/classes, WEB-INF/lib if it does not exist -->
+ <mkdir dir="${basedir}/META-INF/"/>
+ <mkdir dir="${basedir}/WEB-INF/classes/"/>
+ <mkdir dir="${basedir}/WEB-INF/lib/"/>
+ <touch file="${basedir}/META-INF/MANIFEST.MF"/>
+ </target>
+
+ <!-- END OF INITS -->
+
+ <target name="all">
+ <antcall target="build"/>
+ <antcall target="package"/>
+ </target>
+
+ <target name="clean">
+ <init/>
+
+ <delete dir="dist" includeemptydirs="true" quiet="true"/>
+
+ <delete verbose="true">
+ <fileset dir="." includes="**/*.class" />
+ </delete>
+
+ <!-- <antcall target="${archive-type}-clean"/> --> <!-- Removed individual cleans -->
+
+ <iterate target="clean"/>
+ </target>
+
+ <target name="build" if="build">
+ <build/>
+ <!-- <property name="build" value="false"/> -->
+ </target>
+
+ <macrodef name="build">
+ <sequential>
+ <init/>
+ <iterate target="build"/>
+
+<!-- <antcall target="${archive-type}-build"/> -->
+
+ <!-- everything except war and ear -->
+<!--
+ <property name="srcpath" value="${basedir}"/>
+ <property name="destdir" value="${basedir}"/>
+-->
+
+ <!-- if war -->
+<!--
+ <property name="srcpath" value="${basedir}/WEB-INF/classes"/>
+ <property name="destdir" value="${basedir}/WEB-INF/classes"/>
+-->
+
+ <condition property="srcpath" value="${basedir}/WEB-INF/classes" else="${basedir}"><matches string="${archive-type}" pattern="war"/></condition>
+ <condition property="destdir" value="${basedir}/WEB-INF/classes" else="${basedir}"><matches string="${archive-type}" pattern="war"/></condition>
+
+ <echo>PROPS: ${srcpath} ${destdir}</echo>
+
+ <javac destdir="${destdir}" debug="${debug}" debuglevel="${debuglevel}">
+ <src path="${srcpath}"/>
+ <classpath refid="classpath"/>
+ </javac>
+ </sequential>
+ </macrodef>
+
+ <target name="package" depends="build">
+ <mkdir dir="dist"/>
+ <iterate target="package"/>
+
+ <antcall target="${archive-type}-package"/>
+
+ </target>
+
+<!-- JAR Build -->
+
+<!--
+ <target name="jar-build">
+ <sequential>
+ <javac destdir="." debug="${debug}" debuglevel="${debuglevel}">
+ <src path="${basedir}"/>
+ <classpath refid="classpath"/>
+ </javac>
+ </sequential>
+ </target>
+-->
+ <target name="jar-package">
+ <jar-package/>
+ </target>
+
+ <target name="aop-package">
+ <jar-package/>
+ </target>
+
+ <target name="beans-package">
+ <jar-package/>
+ </target>
+
+ <target name="sar-package">
+ <jar-package/>
+ </target>
+
+ <macrodef name="jar-package">
+ <sequential>
+<!--
+ <manifest file="META-INF/MANIFEST.MF" mode="update">
+ <attribute name="Class-Path" value="${manifest-class-path}"/>
+ <attribute name="Main-Class" value="${main-class}"/>
+ </manifest>
+-->
+
+ <jar destfile="dist/${archive.name}" manifest="META-INF/MANIFEST.MF">
+ <fileset refid="jar.package.fileset"/>
+ </jar>
+ </sequential>
+ </macrodef>
+
+<!-- WAR -->
+<!--
+ <target name="war-all" depends="war-build, war-package"> </target>
+
+ <target name="war-clean"> </target>
+-->
+
+ <target name="war-build">
+
+ <javac destdir="WEB-INF/classes/" debug="${debug}" debuglevel="${debuglevel}">
+ <src path="WEB-INF/classes"/>
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="war-package">
+ <mkdir dir="dist"/>
+
+<!--
+ <manifest file="META-INF/MANIFEST.MF" mode="update">
+ <attribute name="Class-Path" value="${manifest-class-path}"/>
+ </manifest>
+-->
+
+
+ <war destfile="dist/${archive.name}" needxmlfile="false" manifest="META-INF/MANIFEST.MF">
+ <fileset refid="war.package.fileset"/>
+ </war>
+ </target>
+
+<!-- SAR & rar same as jar-->
+
+<!-- EAR -->
+ <uptodate property="ear-package.notrequired" targetfile="dist/${archive.name}" >
+ <srcfiles dir= "${basedir}" includes="**/dist/*"/>
+ </uptodate>
+
+ <target name="ear-all" depends="">
+ <echo>Calling sub archives build</echo>
+ <!--<antcall target="ear-build"/>-->
+ <antcall target="ear-package"/>
+ </target>
+
+<!--
+ <target name="ear-build">
+ </target>
+-->
+
+ <target name="ear-package" if="ear">
+ <sequential>
+ <!-- call it here, b/c ear does not have build called on it, putting it in package would be duplicated by the depends=build -->
+ <init/>
+ <!-- call herre, b/c depends would delete the dist files before checking ear-package.notrequired -->
+ <delete dir="dist" includeemptydirs="true" quiet="true" includes="**/*"/>
+
+ <mkdir dir="packaging"/>
+ <mkdir dir="packaging/lib/"/>
+
+ <copy flatten="true" todir="packaging">
+ <fileset dir="${basedir}">
+ <include name="*/dist/*"/>
+ </fileset>
+ </copy>
+
+ <copy flatten="true" todir="packaging/lib/">
+ <fileset dir="${basedir}/lib">
+ <include name="*.jar/dist/*.jar"/> <!-- include dirs *.jar/dist/*.jar and any jar files in the lib -->
+ <include name="*.jar"/>
+ <type type="file"/>
+ </fileset>
+ </copy>
+
+ <ear destfile="dist/${archive.name}" appxml="META-INF/application.xml">
+<!--
+ <manifest>
+ <attribute name="Class-Path" value="${manifest-class-path}"/>
+ </manifest>
+-->
+ <fileset dir="${basedir}">
+ <include name="*"/>
+ <type type="file"/>
+ <exclude name="build.xml"/>
+ <exclude name="build.properties"/>
+ <exclude name=".*"/>
+ </fileset>
+ <fileset dir="${basedir}" includes="META-INF/**/*"/>
+ <fileset dir="${basedir}/packaging/" includes="**/*"/>
+ </ear>
+ <delete dir="packaging" includeemptydirs="true" quiet="true"/>
+ </sequential>
+ </target>
+
+ <property name="distDir" location="./dist/"/>
+
+ <target name="deploy" depends="all">
+ <copy todir="${jboss-deploy-dir}" verbose="true">
+ <fileset dir="${distDir}" includes="**/*"/>
+ </copy>
+ </target>
+
+ <target name="undeploy">
+ <pathconvert property="undeploy.files" pathsep=" ">
+ <mapper type="regexp" from="^${distDir}/(.*)$" to="${jboss-deploy-dir}/\1"/>
+ <fileset dir="${distDir}" includes="**/*"/>
+ </pathconvert>
+ <echo>Undeploy ${undeploy.files}</echo>
+ <delete includeemptydirs="true" verbose="true">
+ <filelist files="${undeploy.files}" />
+ </delete>
+ </target>
+
+
+ <target name="test" depends="build">
+ <echo>${jboss-endorsed-dir}</echo>
+ <java classname="${test-client}" fork="true">
+ <jvmarg value="-Djava.endorsed.dirs=${jboss-endorsed-dir}"/>
+ <jvmarg value="-Djava.security.policy=${auth-conf}"/>
+<!--
+ -Djava.security.manager -Djava.security.policy=$JBOSS_HOME/bin/java.policy"
+-->
+ <classpath>
+ <path refid="classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="junit" depends="build">
+ <!-- <echo>security-policy: ${security-policy}</echo> -->
+ <junit fork="false" showoutput="true" printsummary="true" filtertrace="false"
+ haltonfailure="false"
+ outputtoformatters="false">
+<!--
+ <jvmarg value="-Djava.rmi.server.logCalls=true"/>
+ <jvmarg value="-Djava.security.policy=${security-policy}"/>
+ <sysproperty key="java.security.policy" value="${security-policy}"/>
+
+ <jvmarg value="-Djava.security.auth.login.config=${auth-conf}"/>
+ <sysproperty key="java.security.auth.login.config" value="${auth-conf}"/>
+-->
+
+ <classpath refid="classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test name="${test-case}"/>
+ </junit>
+ </target>
+
+ <target name="export-zip" depends="clean">
+ <mkdir dir="${dist}"/>
+ <zip destfile="${dist}/${archive-name}-src.zip">
+ <fileset dir="../">
+ <include name="${archive.name}/**/*"/>
+ <exclude name="${dist}"/>
+ </fileset>
+ </zip>
+ </target>
+
+ <target name="export-testcase" depends="clean">
+ <echo>This target will split this deployment up into java files and resources which is useful when moving it to the JBoss testsuite</echo>
+ <input message="Enter java source directory:" addproperty="testcase.source.dir"/>
+ <input message="Enter resource directory:" addproperty="testcase.resource.dir"/>
+
+ <echo>Copying java source to ${testcase.source.dir}</echo>
+ <mkdir dir="${testcase.source.dir}"/>
+ <copy todir="${testcase.source.dir}">
+ <fileset dir=".">
+ <include name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <echo>Copying resources to ${testcase.resource.dir}</echo>
+ <mkdir dir="${testcase.resource.dir}"/>
+ <copy todir="${testcase.resource.dir}">
+ <fileset dir=".">
+ <exclude name="**/*.java"/>
+ <exclude name="**/build.xml"/>
+ <exclude name="**/build.properties"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="help">
+ <echo>archive-name = ${archive-name}</echo>
+ <echo>all - builds and packages the archive in the dist/ directory</echo>
+ <echo>build - builds the *.java files</echo>
+ <echo>clean - deletes the compiled classes *.java and the dist/ directory</echo>
+ <echo>deploy - deploys the archive in $JBOSS_HOME/server/$JBOSS_PROFILE - defaults to default, can be set in env variables or build.properties</echo>
+ <echo>export-zip - cleans then zips up the source in a zip file in dist/ directory</echo>
+ <echo>test - calls build, then runs a test client, the test client class is defined in build.properties property name: test-client</echo>
+ <echo>undeploy - undeploys the archive in $JBOSS_HOME/server/$JBOSS_SERVER - defaults to default, can be set in env variables or build.properties</echo>
+ </target>
+
+ <target name="mavenize-package" if="ear">
+ <sequential>
+ <!-- call it here, b/c ear does not have build called on it, putting it in package would be duplicated by the depends=build -->
+ <init/>
+ <!-- call herre, b/c depends would delete the dist files before checking ear-package.notrequired -->
+ <!-- <delete dir="dist" includeemptydirs="true" quiet="true" includes="**/*"/> -->
+
+ <!-- <copy flatten="true" todir="${dist}"> -->
+ <copy todir="${dist}">
+ <fileset dir="${basedir}/">
+ <include name="*/dist/**/*"/>
+ </fileset>
+ <regexpmapper from="^.*/dist/(.*)$$" to="\1"/>
+ </copy>
+
+<!--
+ <copy flatten="true" todir="packaging/lib/">
+ <fileset dir="${basedir}/lib">
+ <include name="*.jar/dist/*.jar"/>
+ <include name="*.jar"/>
+ <type type="file"/>
+ </fileset>
+ </copy>
+-->
+<!--
+ <ear destfile="dist/${archive.name}" appxml="META-INF/application.xml">
+ <fileset dir="${basedir}">
+ <include name="*"/>
+ <type type="file"/>
+ <exclude name="build.xml"/>
+ <exclude name="build.properties"/>
+ <exclude name=".*"/>
+ </fileset>
+ <fileset dir="${basedir}" includes="META-INF/**/*"/>
+ <fileset dir="${basedir}/packaging/" includes="**/*"/>
+ </ear>
+-->
+ </sequential>
+ </target>
+
+ <macrodef name="mavenize-ejb-template">
+ <attribute name="outputFile"/>
+
+ <attribute name="project-groupId"/>
+ <attribute name="project-artifactId"/>
+ <attribute name="project-version"/>
+ <attribute name="project-name"/>
+ <attribute name="project-description"/>
+
+ <attribute name="parent-groupId"/>
+ <attribute name="parent-artifactId"/>
+ <attribute name="parent-version"/>
+ <attribute name="parent-relativePath"/>
+
+ <attribute name="build-finalName"/>
+ <sequential>
+ <copy tofile="@{outputFile}/" file="ejb-pom.xml">
+ <filterset>
+ <filter token="project-groupId" value="@{project-groupId}"/>
+ <filter token="project-artifactId" value="@{project-artifactId}"/>
+ <filter token="project-version" value="@{project-version}"/>
+ <filter token="project-name" value="@{project-name}"/>
+ <filter token="project-description" value="@{project-description}"/>
+
+ <filter token="parent-groupId" value="@{parent-groupId}"/>
+ <filter token="parent-artifactId" value="@{parent-artifactId}"/>
+ <filter token="parent-version" value="@{parent-version}"/>
+ <filter token="parent-relativePath" value="@{parent-relativePath}"/>
+
+ <filter token="build-finalName" value="@{build-finalName}"/>
+ </filterset>
+ </copy>
+ </sequential>
+ </macrodef>
+
+ <target name="mavenize" depends="clean">
+ <mkdir dir="${dist}"/>
+
+ <iterate target="mavenize"/>
+
+ <!-- create a top level parent directory for the example that will have a pom.xml to call all the others ? -->
+
+ <!-- create directory without extension for each -->
+ <!-- using iterate, create them using archive-name in dist -->
+ <mkdir dir="${dist}/${archive-name}-${archive-type}"/>
+
+ <!-- note only jars that do not have a build.xml should be copied, everything else should be done via maven dependency -->
+ <!-- how to deal with jars in ear/lib, war/WEB-INF/lib ? Does maven structure have a lib directory to avoid pom.xml settings ? -->
+ <!-- war has my-webapp/src/main/webapp/WEB-INF , it looks like creating a lib dir and copying jars may work -->
+ <!-- ear has my-earapp/src/main/application/lib, it looks like creating a lib dir and copying jars may work -->
+
+ <echo>mavenize ${dist}/${archive-name}-${archive-type}/pom.xml</echo>
+ <mavenize-ejb-template outputFile="${dist}/${archive-name}-${archive-type}/pom.xml"
+ project-groupId="org.jboss.as.quickstarts" project-artifactId="${archive-name}-${archive-type}"
+ project-version="7.1.2.Final-redhat-1" project-name="${archive-name}-${archive-type}"
+ project-description="${archive-name}-${archive-type} description"
+ parent-groupId="org.jboss.as.quickstarts" parent-artifactId="${archive-name}"
+ parent-version="7.1.2.Final-redhat-1" parent-relativePath="../pom.xml"
+ build-finalName="${archive-name}-${archive-type}"/>
+
+ <!-- copy META-INF to resources -->
+ <mkdir dir="${dist}/${archive-name}-${archive-type}/src/main/resources/"/>
+ <copy todir="${dist}/${archive-name}-${archive-type}/src/main/resources/">
+ <fileset dir="${basedir}">
+ <include name="META-INF/**/*"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${dist}/${archive-name}-${archive-type}/src/main/java/"/>
+ <copy todir="${dist}/${archive-name}-${archive-type}/src/main/java/">
+ <fileset dir="${basedir}">
+ <exclude name="dist/**/*"/>
+ <exclude name="dist/"/>
+ <exclude name="META-INF/"/>
+ <exclude name="META-INF/**/*"/>
+ <exclude name="build.xml"/>
+ <exclude name="build.properties"/>
+ <exclude name="*pom.xml"/>
+ <exclude name="*.sh"/>
+ </fileset>
+ </copy>
+
+<!--
+ It looks like each module just needs to specify parent, packaging type, and artifact, then have the ear declare dependencies on the sub modules
+ <parent>
+ <artifactId>ejb-remote-eap6</artifactId>
+ <groupId>ejb-remote-eap6</groupId>
+ <version>7.1.1.CR2</version>
+ </parent>
+
+ <artifactId>ejb-remote-eap6-ear</artifactId>
+ <packaging>ear</packaging>
+
+ <name>ejb-remote-eap6 EAR module</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>ejb-remote-eap6</groupId>
+ <artifactId>ejb-remote-eap6-web</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>ejb-remote-eap6</groupId>
+ <artifactId>ejb-remote-eap6-ejb</artifactId>
+ <type>ejb</type>
+ </dependency>
+ </dependencies>
+-->
+
+
+ <!-- copy appropriate pom.xml, use the @ replace against a template -->
+ <touch file="${dist}/${archive-name}-${archive-type}/pom.xml"/>
+
+ <!-- create .project ? -->
+
+ <!-- This will only get called for an ear currently -->
+ <antcall target="mavenize-package"/>
+ </target>
+
+</project>
View
70 cxfWssX509EjbEap5.jar/com/redhat/gss/wsse/KeystorePasswordCallback.java
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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 com.redhat.gss.wsse;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import org.apache.ws.security.WSPasswordCallback;
+
+public class KeystorePasswordCallback implements CallbackHandler
+{
+
+ private Map<String, String> passwords = new HashMap<String, String>();
+
+ public KeystorePasswordCallback()
+ {
+ passwords.put("alice", "password");
+ passwords.put("bob", "password");
+ }
+
+ /**
+ * It attempts to get the password from the private
+ * alias/passwords map.
+ */
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
+ {
+ for (int i = 0; i < callbacks.length; i++)
+ {
+ WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+
+ String pass = passwords.get(pc.getIdentifer());
+ if (pass != null)
+ {
+ pc.setPassword(pass);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Add an alias/password pair to the callback mechanism.
+ */
+ public void setAliasPassword(String alias, String password)
+ {
+ passwords.put(alias, password);
+ }
+}
View
38 cxfWssX509EjbEap5.jar/com/redhat/gss/wsse/ServiceIface.java
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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 com.redhat.gss.wsse;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+(
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecurity"
+)
+public interface ServiceIface
+{
+ @WebMethod
+ String sayHello();
+
+ @WebMethod
+ String greetMe();
+}
View
44 cxfWssX509EjbEap5.jar/com/redhat/gss/wsse/ServiceImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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 com.redhat.gss.wsse;
+
+import javax.jws.WebService;
+
+@WebService
+(
+ serviceName = "SecurityService",
+ wsdlLocation = "META-INF/wsdl/SecurityService.wsdl",
+ targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wssecurity",
+ endpointInterface = "com.redhat.gss.wsse.ServiceIface"
+)
+@javax.ejb.Stateless
+public class ServiceImpl implements ServiceIface
+{
+ public String sayHello()
+ {
+ return "Secure Hello World!";
+ }
+ public String greetMe()
+ {
+ return "Greetings!";
+ }
+}
View
61 cxfWssX509EjbEap5.jar/com/redhat/gss/wsse/SignTest.java
@@ -0,0 +1,61 @@
+package com.redhat.gss.wsse;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+
+public class SignTest
+{
+ private final String serviceURL = "http://localhost:8080/cxfWssX509EjbEap5/ServiceImpl";
+
+ public static void main(String[] args) throws Exception
+ {
+ new SignTest().test();
+ }
+
+ public void test() throws Exception
+ {
+ QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecurity", "SecurityService");
+ URL wsdlURL = new URL(serviceURL + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
+ setupWsse(proxy);
+ proxy.sayHello();
+ }
+
+ private void setupWsse(ServiceIface proxy)
+ {
+ Client client = ClientProxy.getClient(proxy);
+ Endpoint cxfEndpoint = client.getEndpoint();
+
+ Map<String,Object> outProps = new HashMap<String,Object>();
+ outProps.put("action", "Timestamp Signature");
+ outProps.put("user", "alice");
+ outProps.put("signaturePropFile", "META-INF/alice.properties");
+ outProps.put("signatureKeyIdentifier", "DirectReference");
+ outProps.put("passwordCallbackClass", "com.redhat.gss.wsse.KeystorePasswordCallback");
+ outProps.put("signatureParts", "{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body");
+ WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps); //request
+ cxfEndpoint.getOutInterceptors().add(wssOut);
+ cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());
+
+ Map<String,Object> inProps= new HashMap<String,Object>();
+ inProps.put("action", "Timestamp Signature");
+ inProps.put("signaturePropFile", "META-INF/alice.properties");
+ inProps.put("passwordCallbackClass", "com.redhat.gss.wsse.KeystorePasswordCallback");
+ WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps); //response
+ cxfEndpoint.getInInterceptors().add(wssIn);
+ cxfEndpoint.getInInterceptors().add(new SAAJInInterceptor());
+ }
+}
View
2  simpleLoggingHandler.jar/README.md
@@ -1,5 +1,5 @@
###Simple Logging Handler
-This project installs a simple java.util.logging.Handler into JBoss. The handler esentially duplicates all log messages to `STDOUT`. All custom handlers need to call `isLoggable()` to check the logging level and also need to use its formatter to format each message. Examine `standalone-changes.diff` if you want to see the changes necessary to install the custom logger in JBoss.
+This project installs a simple `java.util.logging.Handler` into JBoss. The handler esentially duplicates all log messages to `STDOUT`. All custom handlers need to call `isLoggable()` to check the logging level and also need to use its formatter to format each message. Examine `standalone-changes.diff` if you want to see the changes necessary to install the custom logger in JBoss.
To build and deploy this example, run `./installHandler.sh`, which will run ant, create the module, and make the changes to `standalone.xml`. The diff assumes the `standalone.xml` has been unmodified from the stock version of EAP 6.

No commit comments for this range

Something went wrong with that request. Please try again.