blob: 87c737872ae95b0a4718d12708432066d57d4fa5 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project [
<!--
Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!ENTITY commonSetup SYSTEM "file:./../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../../config/common.xml">
<!ENTITY commonRun SYSTEM "file:./../../../../config/run.xml">
<!ENTITY commonSecurity SYSTEM "file:../../common.xml">
<!ENTITY testproperties SYSTEM "file:./build.properties">
]>
<project name="security-jmac-soapdefault" default="usage" basedir=".">
&commonSetup;
&commonBuild;
&commonRun;
&testproperties;
&commonSecurity;
<target name="all" depends="clean, build-providers, setup, build-deploy, run, undeploy, unsetup"/>
<target name="clean" depends="init-common">
<antcall target="clean-common"/>
</target>
<target name="build-providers" depends="init-common">
<antcall target="compile-common">
<param name="src" value="authmodule"/>
<param name="build.classes.dir" value="${build.classes.dir}/authmodule"/>
</antcall>
<mkdir dir="${assemble.dir}"/>
<jar jarfile="${assemble.dir}/test-${appname}-provider.jar">
<fileset dir="${build.classes.dir}/authmodule"/>
</jar>
</target>
<target name="setup" depends="init-common">
<!-- exports certdb stuff and imports into keystore -->
<antcall target="prepare-store-nickname-common">
<param name="cert.nickname" value="s1as"/>
</antcall>
<copy file="${assemble.dir}/test-${appname}-provider.jar"
todir="${env.S1AS_HOME}/lib"/>
<antcall target="asadmin-common">
<param name="admin.command" value="create-message-security-provider"/>
<param name="as.props" value="${as.props} --classname com.sun.s1asdev.security.jmac.soapdefault.SOAPDefaultTestServerAuthModule --layer SOAP --providertype server --requestauthsource sender"/>
<param name="operand.props" value="SOAPDefaultTestServerAuthModule"/>
</antcall>
<antcall target="asadmin-common">
<param name="admin.command" value="create-message-security-provider"/>
<param name="as.props" value="${as.props} --classname com.sun.s1asdev.security.jmac.soapdefault.SOAPDefaultTestClientAuthModule --layer SOAP --providertype client --requestauthsource sender"/>
<param name="operand.props" value="SOAPDefaultTestClientAuthModule"/>
</antcall>
<antcall target="enable-wss-message-security-provider">
<param name="wss.server.provider.name" value="SOAPDefaultTestServerAuthModule"/>
<param name="wss.client.provider.name" value="SOAPDefaultTestClientAuthModule"/>
</antcall>
<!--antcall target="restart"/-->
<copy file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml"
tofile="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml.ORIG"/>
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[</message-security-config>]]></replacetoken>
<replacevalue><![CDATA[<provider-config class-name="com.sun.s1asdev.security.jmac.soapdefault.SOAPDefaultTestClientAuthModule" provider-id="SOAPDefaultTestClientAuthModule" provider-type="client">
<request-policy auth-source="sender"/>
</provider-config>
</message-security-config>]]></replacevalue>
</replace>
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[<message-security-config]]></replacetoken>
<replacevalue><![CDATA[<message-security-config default-client-provider="SOAPDefaultTestClientAuthModule"]]></replacevalue>
</replace>
</target>
<target name="unsetup" depends="init-common">
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[<provider-config class-name="com.sun.s1asdev.security.jmac.soap.SOAPDefaultTestClientAuthModule" provider-id="SOAPDefaultTestClientAuthModule" provider-type="client">
<request-policy auth-source="sender"/>
</provider-config>
</message-security-config>]]></replacetoken>
<replacevalue><![CDATA[</message-security-config>]]></replacevalue>
</replace>
<replace file="${admin.domain.dir}/${admin.domain}/config/glassfish-acc.xml">
<replacetoken><![CDATA[<message-security-config default-client-provider="SOAPDefaultTestClientAuthModule"]]></replacetoken>
<replacevalue><![CDATA[<message-security-config]]></replacevalue>
</replace>
<antcall target="asadmin-common">
<param name="admin.command" value="delete-message-security-provider"/>
<param name="as.props" value="${as.props} --layer SOAP"/>
<param name="operand.props" value="SOAPDefaultTestServerAuthModule"/>
</antcall>
<antcall target="asadmin-common">
<param name="admin.command" value="delete-message-security-provider"/>
<param name="as.props" value="${as.props} --layer SOAP"/>
<param name="operand.props" value="SOAPDefaultTestClientAuthModule"/>
</antcall>
<antcall target="disable-wss-message-security-provider"/>
<!-- may not be able to delete this file in PC environment -->
<delete file="${env.S1AS_HOME}/lib/test-${appname}-provider.jar" failonerror="false"/>
</target>
<target name="compile-server" depends="clean">
<antcall target="compile-common">
<param name="src" value="ejbws"/>
<param name="build.classes.dir" value="${build.classes.dir}/ejbws"/>
</antcall>
<antcall target="compile-common">
<param name="src" value="servletws"/>
<param name="build.classes.dir" value="${build.classes.dir}/servletws/WEB-INF/classes"/>
</antcall>
</target>
<target name="compile-client">
<mkdir dir="${build.classes.dir}/client"/>
<antcall target="wsimport">
<param name="wsimport.args"
value="-keep -d ${build.classes.dir}/client http://${http.host}:${http.port}/JmacSoapDefaultEjbService/HelloEjb?WSDL"/>
</antcall>
<antcall target="wsimport">
<param name="wsimport.args"
value="-keep -d ${build.classes.dir}/client http://${http.host}:${http.port}/security-jmac-soapdefault-web/webservice/JmacSoapDefaultServletService/HelloServlet?WSDL"/>
</antcall>
<delete file="client/Client.java" failonerror="false"/>
<copy file="client/Client.java.template" tofile="client/Client.java"/>
<replace file="client/Client.java">
<replacefilter token="@HOST@" value="${http.host}"/>
<replacefilter token="@PORT@" value="${http.port}"/>
</replace>
<javac srcdir="client" destdir="${build.classes.dir}/client"
classpath="${env.APS_HOME}/lib/reporter.jar:${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/modules/webservices-api-osgi.jar:${env.S1AS_HOME}/modules/webservices-osgi.jar:${build.classes.dir}/client"
debug="on" failonerror="true"/>
</target>
<target name="build-server" depends="compile-server">
<mkdir dir="${assemble.dir}"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<antcall target="package-ejbjar-common">
<param name="ejbjar.files" value="${build.classes.dir}/ejbws"/>
<param name="ejb.jar" value="${assemble.dir}/${appname}-ejb.jar"/>
<param name="ejbjar.classes" value="com/sun/**/*.class"/>
</antcall>
<copy file="${web.xml}" tofile="${build.classes.dir}/servletws/WEB-INF/web.xml" failonerror="true"/>
<jar destfile="${assemble.dir}/${appname}-web.war">
<fileset dir="${build.classes.dir}/servletws"/>
</jar>
<copy file="${sun-application.xml}" tofile="${build.classes.dir}/META-INF/sun-application.xml" failonerror="false"/>
<jar jarfile="${assemble.dir}/${appname}App.ear">
<fileset dir="${assemble.dir}">
<include name="*.jar"/>
<include name="*.war"/>
</fileset>
<fileset dir="${build.classes.dir}">
<include name="META-INF/sun-application.xml"/>
</fileset>
</jar>
</target>
<target name="build-client" depends="compile-client">
<mkdir dir="${assemble.dir}"/>
<unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${build.classes.dir}/client"/>
<antcall target="package-appclientjar-common">
<param name="appclientjar.files"
value="${build.classes.dir}/client"/>
<param name="appclient.jar"
value="${assemble.dir}/${appname}-client.jar"/>
<param name="appclientjar.classes"
value="com/sun/**/*.class"/>
</antcall>
</target>
<target name="build-deploy" depends="init-common">
<antcall target="build-server"/>
<antcall target="deploy-common-libraries">
<param name="as.props" value="${as.props}"/>
<param name="libraries" value="${env.S1AS_HOME}/lib/test-${appname}-provider.jar"/>
</antcall>
<antcall target="build-client"/>
<antcall target="deploy-client-common"/>
</target>
<target name="run" depends="init-common">
<exec executable="${APPCLIENT}">
<env key="APPCPATH" value="${env.S1AS_HOME}/lib/test-${appname}-provider.jar"/>
<env key="VMARGS" value="-Djavax.net.ssl.keyStore=${mykeystore.db.file} -Djavax.net.ssl.trustStore=${mytruststore.db.file} -Djavax.net.ssl.keyStorePassword=${ssl.password} -Djavax.net.ssl.trustStorePassword=${ssl.password}"/>
<arg line="-client" />
<arg line="${assemble.dir}/${appname}-clientClient.jar"/>
<arg line="-texauth"/>
<arg line="-user" />
<arg line="javaee" />
<arg line="-password" />
<arg line="javaee" />
</exec>
</target>
<target name="undeploy" depends="init-common">
<antcall target="undeploy-common"/>
<antcall target="undeploy-client-common"/>
</target>
<target name="restart">
<antcall target="restart-server-instance-common"/>
</target>
<target name="usage">
<antcall target="usage-common"/>
</target>
</project>