commiting windows plugin

revert-dabc3590
asok 10 years ago
parent 5e3ebc141c
commit eb52073e37

@ -1,75 +0,0 @@
<!--
~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project default="build-all">
<property name="wso2appserver.home" value="../../../"/>
<property name="repo.location" value="${wso2appserver.home}/repository/deployment/server"/>
<property name="warName" value="jaxrs_basic.war"/>
<property name="build.dir" value="build"/>
<property name="classes" value="${build.dir}/classes"/>
<property name="lib" value="${build.dir}/lib"/>
<property name="webapps" value="${build.dir}/webapps"/>
<property name="src" value="."/>
<path id="compile.classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init" depends="clean">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${webapps}"/>
<mkdir dir="${lib}"/>
<copy toDir="${lib}">
<fileset dir="${wso2appserver.home}/repository/components/plugins/">
<include name="commons-httpclient_3.1.0.wso2v2.jar"/>
<include name="commons-codec_1.4.0.wso2v1.jar"/>
</fileset>
<fileset dir="${wso2appserver.home}/lib/runtimes/cxf/">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="compile" depends="init" >
<javac destdir="${classes}" debug="true" srcdir="src">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="war" depends="compile">
<echo message="Creating webapp ${warName}."/>
<copy file="src/main/java/demo/jaxrs/client/add_customer.xml" todir="${classes}/demo/jaxrs/client"/>
<copy file="src/main/java/demo/jaxrs/client/update_customer.xml" todir="${classes}/demo/jaxrs/client"/>
<war destfile="${webapps}/${warName}" webxml="./src/main/webapp/WEB-INF/web.xml">
<classes dir="${classes}"/>
<fileset dir="src/main/webapp/"/>
</war>
</target>
<target name="build-all" depends ="war">
<echo message="Copying the created war file in to the deployment directory"/>
<copy file="${webapps}/${warName}" todir="${repo.location}/webapps"/>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>

@ -1,17 +1,19 @@
<!-- <!--
~ Copyright 2011-2012 WSO2, Inc. (http://wso2.com) ~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ WSO2 Inc. licenses this file to you under the Apache License,
~ you may not use this file except in compliance with the License. ~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at ~ You may obtain a copy of the License at
~ ~
~ http://www.apache.org/licenses/LICENSE-2.0 ~ http://www.apache.org/licenses/LICENSE-2.0
~ ~
~ Unless required by applicable law or agreed to in writing, software ~ Unless required by applicable law or agreed to in writing,
~ distributed under the License is distributed on an "AS IS" BASIS, ~ software distributed under the License is distributed on an
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ See the License for the specific language governing permissions and ~ KIND, either express or implied. See the License for the
~ limitations under the License. ~ specific language governing permissions and limitations
~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
@ -27,9 +29,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>cdm-windows-api</artifactId> <artifactId>cdm-android-api</artifactId>
<name>JAX-RS Windows API</name> <name>JAX-RS Android API</name>
<description>JAX-RS Windows API</description> <description>JAX-RS Android API</description>
<packaging>war</packaging> <packaging>war</packaging>
<build> <build>
@ -127,23 +129,11 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId> <artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId> <artifactId>org.wso2.carbon.utils</artifactId>
@ -152,13 +142,11 @@
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -167,24 +155,18 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>org.apache.wss4j</groupId>
<artifactId>log4j</artifactId> <artifactId>wss4j-ws-security-common</artifactId>
<version>1.2.17</version> <version>2.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>bcpkix-jdk15on</artifactId> <artifactId>cxf-rt-ws-security</artifactId>
<version>1.49</version> <version>2.6.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.codehaus.jackson</groupId>
<artifactId>bcprov-jdk15on</artifactId> <artifactId>jackson-jaxrs</artifactId>
<version>1.49</version>
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<cxf.version>2.6.1</cxf.version>
<junit.version>4.8.2</junit.version>
</properties>
</project> </project>

@ -1,81 +0,0 @@
@echo off
REM ---------------------------------------------------------------------------
REM Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
rem ---------------------------------------------------------------------------
rem Client script for the Jaxws-Jaxrs/jaxrs_basic Sample
rem
rem Environment Variable Prequisites
rem
rem WSO2AppServer_HOME Must point at your WSO2 AppServer directory
rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem
rem JAVA_OPTS (Optional) Java runtime options
rem ---------------------------------------------------------------------------
set CURRENT_DIR=%cd%
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo The JAVA_HOME environment variable is not defined
echo This environment variable is needed to run this program
goto end
:gotJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
goto okJavaHome
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
echo NB: JAVA_HOME should point to a JDK/JRE
goto end
:okJavaHome
rem check the WSO2AppServer_HOME environment variable
if not "%WSO2AppServer_HOME%" == "" goto gotHome
set WSO2AppServer_HOME=%CURRENT_DIR%
if exist "%WSO2AppServer_HOME\bin\version.txt" goto okHome
rem guess the home. Jump two directories up to check if that is the home
cd ..\..\..
set WSO2AppServer_HOME=%cd%
cd %CURRENT_DIR%
:gotHome
if exist "%WSO2AppServer_HOME%\bin\version.txt" goto okHome
set WSO2AppServer_HOME=%~dp0..\..
if exist "%WSO2AppServer_HOME%\bin\version.txt" goto okHome
echo The WSO2AppServer_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
rem set the classes
setlocal EnableDelayedExpansion
rem loop through the libs and add them to the class path
cd %WSO2AppServer_HOME%\samples\Jaxws-Jaxrs\jaxrs_basic
set CLIENT_CLASSPATH=.\conf;.\build\classes
FOR %%C in (.\build\lib\*.jar) DO set CLIENT_CLASSPATH=!CLIENT_CLASSPATH!;.\build\lib\%%~nC%%~xC
rem ----- Execute The Requested Command ---------------------------------------
echo Using WSO2AppServer_HOME: %WSO2AppServer_HOME%
echo Using JAVA_HOME: %JAVA_HOME%
set _RUNJAVA="%JAVA_HOME%\bin\java"
%_RUNJAVA% %JAVA_OPTS% -Dwso2appserver.home="%WSO2AppServer_HOME%" -cp "%CLIENT_CLASSPATH%" -Djava.endorsed.dirs="%WSO2AppServer_HOME%\lib\endorsed";"%JAVA_HOME%\jre\lib\endorsed";"%JAVA_HOME%\lib\endorsed" demo.jaxrs.client.Client http://localhost:9763/jaxrs_basic/services/customers/customerservice %*
cd %CURRENT_DIR%
endlocal
:end

@ -1,90 +0,0 @@
#!/bin/sh
# -----------------------------------------------------------------------------
#
# Environment Variable Prequisites
#
# CARBON_HOME Home of WSO2 AppServer installation. If not set I will try
# to figure it out.
#
# JAVA_HOME Must point at your Java Development Kit installation.
#
# NOTE: Borrowed generously from Apache Tomcat startup scripts.
# if JAVA_HOME is not set we're not happy
if [ -z "$JAVA_HOME" ]; then
echo "You must set the JAVA_HOME variable before running WSO2 AppServer."
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set WSO2AppServer_HOME if not already set
[ -z "$CARBON_HOME" ] && CARBON_HOME=`cd "$PRGDIR/../../.." ; pwd`
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CARBON_HOME" ] && WSO2AppServer_HOME=`cygpath --unix "$CARBON_HOME"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For OS400
if $os400; then
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
system $COMMAND
# Enable multi threading
QIBM_MULTI_THREADED=Y
export QIBM_MULTI_THREADED
fi
# update classpath
CLIENT_CLASSPATH=""
for f in "$CARBON_HOME"/samples/Jaxws-Jaxrs/jaxrs_basic/build/lib/*.jar
do
CLIENT_CLASSPATH=$CLIENT_CLASSPATH:$f
done
CLIENT_CLASSPATH=$CLIENT_CLASSPATH:$CLASSPATH
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
CARBON_HOME=`cygpath --absolute --windows "$CARBON_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
echo Using CARBON_HOME: $CARBON_HOME
echo Using JAVA_HOME : $JAVA_HOME
CLIENT_CLASSPATH="$CARBON_HOME/samples/Jaxws-Jaxrs/jaxrs_basic/build/classes":$CLIENT_CLASSPATH
$JAVA_HOME/bin/java -Dwso2appserver.home="$CARBON_HOME" -classpath "$CLIENT_CLASSPATH" \
-Djava.endorsed.dirs="$CARBON_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
demo.jaxrs.client.Client http://localhost:9763/jaxrs_basic/services/customers/customerservice$*

@ -1,47 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package cdm.api.windows;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import java.io.InputStream;
@Path("/EnrollmentServer")
public interface DiscoveryService {
@Path("/Discovery.svc")
@POST
@Consumes({ "application/soap+xml;charset=utf-8", "application/xml" })
@Produces("application/soap+xml;charset=utf-8")
Response getDiscoveryResponse(
InputStream discoveryRequest);
@Path("/Discovery.svc")
@GET
@Consumes("text/html")
@Produces("text/html")
Response getDiscoveryOKRequest();
@Path("/Discovery.svc")
@GET
@Consumes({ "application/soap+xml;charset=utf-8", "application/xml" })
@Produces("text/html")
Response getDiscoveryOKRequestWithBody(InputStream discoveryRequest);
}

@ -1,43 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package cdm.api.windows;
import javax.swing.text.Document;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
@Path("/ENROLLMENTSERVER")
public interface EnrolmentService {
@Path("/PolicyEnrollmentWebservice.svc")
@POST
@Consumes("application/soap+xml;charset=utf-8")
@Produces("application/soap+xml;charset=utf-8")
Response getPolicies(Document request);
@Path("/DeviceEnrollmentWebservice.svc")
@POST
@Consumes("application/soap+xml;charset=utf-8")
@Produces("application/soap+xml;charset=utf-8")
Response enrollUser(Document request);
}

@ -1,72 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package cdm.api.windows.impl;
import cdm.api.windows.DiscoveryService;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.log4j.Logger;
public class DiscoveryServiceImpl implements DiscoveryService {
private Logger LOGGER = Logger.getLogger(DiscoveryServiceImpl.class);
public Response getDiscoveryResponse(InputStream discoveryRequest) {
LOGGER.info("Received Discovery Service POST Request [{}]");
String response = null;
File file = null;
FileInputStream fis = null;
byte[] data = null;
try {
file = new File("./conf/discover-service.xml");
fis = new FileInputStream(file);
data = new byte[(int) file.length()];
fis.read(data);
fis.close();
response = new String(data, "UTF-8");
} catch (IOException e) {
LOGGER.error("An Unexpected Error has occurred while processing the request ", e);
}
LOGGER.info("Sending Discovery Response");
return Response.ok().entity(response).build();
}
public Response getDiscoveryOKRequest() {
LOGGER.info("Received a GET Request without body");
return Response.ok().build();
}
public Response getDiscoveryOKRequestWithBody(InputStream discoveryRequest) {
LOGGER.info("Received a GET Request with body [{}]");
return Response.ok().build();
}
}

@ -1,305 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package cdm.api.windows.impl;
import cdm.api.windows.EnrolmentService;
import org.apache.log4j.Logger;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.swing.text.Document;
import javax.ws.rs.core.Response;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Iterator;
import cdm.api.windows.util.CertificateSigningService;
public class EnrolmentServiceImpl implements EnrolmentService {
private Logger LOGGER = Logger.getLogger(EnrolmentServiceImpl.class);
static {
Security.addProvider(new BouncyCastleProvider());
}
private String enrollmentResponseFile;
private String wapProvisioningXmlFile;
private String privatePemKeyFilePath;
private String caCertificateFilePath;
PrivateKey privateKey;
X509Certificate rooCACertificate;
public void init() {
try {
FileInputStream in = new FileInputStream(privatePemKeyFilePath);
byte[] keyBytes = new byte[in.available()];
in.read(keyBytes);
in.close();
String key = new String(keyBytes, "UTF-8");
key = key.replaceAll(
"(-+BEGIN RSA PRIVATE KEY-+\\r?\\n|-+END RSA PRIVATE KEY-+\\r?\\n?)", "");
// don't use this for real projects!
BASE64Decoder decoder = new BASE64Decoder();
keyBytes = decoder.decodeBuffer(key);
// generate private key
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
privateKey = keyFactory.generatePrivate(spec);
LOGGER.info("Private Key Algorithm : " + privateKey.getAlgorithm());
} catch (Exception e) {
LOGGER.error("An unexpected Error has occurred while reading CA Private Key, ", e);
}
try {
FileInputStream fr = new FileInputStream(caCertificateFilePath);
CertificateFactory cf = CertificateFactory.getInstance("X509");
rooCACertificate = (X509Certificate) cf.generateCertificate(fr);
rooCACertificate.verify(rooCACertificate.getPublicKey());
LOGGER.info("CA Certificate Expiration Date : " + rooCACertificate.getNotAfter());
} catch (Exception e) {
LOGGER.error("An unexpected Error has occurred while reading CA Root Certificate, ", e);
}
/*try {
KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
gen.initialize(2048);
key = gen.generateKeyPair();
PrivateKey privateKey = key.getPrivate();
PublicKey publicKey = key.getPublic();
*//**
* Following details need to be provided
*
* Serial number
* Signature algorithm
* Issuer Name.
* Subject Name -- or a Subject Alternative Name (SAN).
* Date range (not before, not after).
* Subject Public Key.
*//*
X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator();
v3CertGen.setSerialNumber(BigInteger.valueOf(new SecureRandom().nextInt(Integer.MAX_VALUE)));
v3CertGen.setIssuerDN(new X509Principal("CN=wso2.com"));
//v3CertGen.setIssuerDN(new X509Principal("CN=wso2.com, OU=Mobile, O=wso2 L=Colombo, C=LK"));
v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10)));
v3CertGen.setSubjectDN(new X509Principal("CN=wso2.com"));
v3CertGen.setPublicKey(publicKey);
v3CertGen.setSignatureAlgorithm("SHA1withRSA");
rooCACertificate = v3CertGen.generateX509Certificate(privateKey);
} catch (Exception e) {
e.printStackTrace();
}*/
}
public Response getPolicies(Document request) {
LOGGER.info("Received Get Policies Request");
String response = null;
File file = null;
FileInputStream fis = null;
byte[] data = null;
try {
file = new File("./conf/policy-service.xml");
fis = new FileInputStream(file);
data = new byte[(int) file.length()];
fis.read(data);
fis.close();
response = new String(data, "UTF-8");
} catch (IOException e) {
LOGGER.error("An Unexpected Error has occurred while processing the request ", e);
}
LOGGER.info("Sending Get Policy Response");
return Response.ok().entity(response).build();
}
public Response enrollUser(Document request) {
LOGGER.info("Received User Enrollment Request");
XPath xPath = XPathFactory.newInstance().newXPath();
xPath.setNamespaceContext(new MyNamespaceContext());
String response = null;
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
try {
NodeList nl = (NodeList) xPath.evaluate(
"/s:Envelope/s:Body/wst:RequestSecurityToken/wsse:BinarySecurityToken", request,
XPathConstants.NODESET);
Node node = nl.item(0);
String certificateDataString = node.getTextContent();
byte[] derByteArray =
javax.xml.bind.DatatypeConverter.parseBase64Binary(certificateDataString);
PKCS10CertificationRequest certificationRequest =
new PKCS10CertificationRequest(derByteArray);
JcaPKCS10CertificationRequest csrReq =
new JcaPKCS10CertificationRequest(certificationRequest);
LOGGER.info("Public Key of CSR : " + csrReq.getPublicKey());
X509Certificate signedCert =
CertificateSigningService.signCSR(csrReq, privateKey, rooCACertificate);
LOGGER.info("Verifying Signed Certificate with CSR's public key : " +
signedCert.getPublicKey());
BASE64Encoder base64Encoder = new BASE64Encoder();
String rootCertEncodedString = base64Encoder.encode(rooCACertificate.getEncoded());
String signedCertEncoded = base64Encoder.encode(signedCert.getEncoded());
DocumentBuilder builder = domFactory.newDocumentBuilder();
org.w3c.dom.Document dDoc = builder.parse(wapProvisioningXmlFile);
NodeList wapParm = dDoc.getElementsByTagName("parm");
NamedNodeMap rootCertAttributes = wapParm.item(0).getAttributes();
Node b64Encoded = rootCertAttributes.getNamedItem("value");
b64Encoded.setTextContent(rootCertEncodedString);
NamedNodeMap clientCertAttributes = wapParm.item(1).getAttributes();
Node b64CliendEncoded = clientCertAttributes.getNamedItem("value");
b64CliendEncoded.setTextContent(signedCertEncoded);
String wapProvisioning = convertDocumentToString(dDoc);
String encodedWap = base64Encoder.encode(wapProvisioning.getBytes());
org.w3c.dom.Document responseXml = builder.parse(enrollmentResponseFile);
NodeList token = responseXml.getElementsByTagName("BinarySecurityToken");
Node firstToken = token.item(0);
firstToken.setTextContent(encodedWap);
response = convertDocumentToString(responseXml);
} catch (Exception e) {
LOGGER.error("An Unexpected Error has occurred while processing the request ", e);
}
LOGGER.info("Sending User Enrollment Response");
return Response.ok().entity(response).build();
}
private String convertDocumentToString(org.w3c.dom.Document document) throws Exception {
DOMSource domSource = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
String wapProvisioning = writer.toString();
return wapProvisioning;
}
public void setEnrollmentResponseFile(String enrollmentResponseFile) {
this.enrollmentResponseFile = enrollmentResponseFile;
}
public void setWapProvisioningXmlFile(String wapProvisioningXmlFile) {
this.wapProvisioningXmlFile = wapProvisioningXmlFile;
}
public void setPrivatePemKeyFilePath(String privatePemKeyFilePath) {
this.privatePemKeyFilePath = privatePemKeyFilePath;
}
public void setCaCertificateFilePath(String caCertificateFilePath) {
this.caCertificateFilePath = caCertificateFilePath;
}
public void setPrivateKey(PrivateKey privateKey) {
this.privateKey = privateKey;
}
public void setRooCACertificate(X509Certificate rooCACertificate) {
this.rooCACertificate = rooCACertificate;
}
private static class MyNamespaceContext implements NamespaceContext {
public String getNamespaceURI(String prefix) {
if ("s".equals(prefix)) {
return "http://www.w3.org/2003/05/soap-envelope";
} else if ("wst".equals(prefix)) {
return "http://docs.oasis-open.org/ws-sx/ws-trust/200512";
} else if ("wsse".equals(prefix)) {
return "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
}
return null;
}
public String getPrefix(String namespaceURI) {
return null;
}
public Iterator getPrefixes(String namespaceURI) {
return null;
}
}
}

@ -1,92 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package cdm.api.windows.util;
import org.apache.log4j.Logger;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils;
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
import java.math.BigInteger;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Date;
public class CertificateSigningService {
private static Logger LOGGER = Logger.getLogger(CertificateSigningService.class);
public static X509Certificate signCSR(JcaPKCS10CertificationRequest jcaRequest,
PrivateKey privateKey, X509Certificate caCert)
throws Exception {
try {
X509v3CertificateBuilder certificateBuilder = new JcaX509v3CertificateBuilder(caCert,
BigInteger
.valueOf(
new SecureRandom()
.nextInt(
Integer.MAX_VALUE)),
new Date(
System.currentTimeMillis() -
1000L *
60 *
60 *
24 *
30),
new Date(
System.currentTimeMillis() +
(1000L *
60 *
60 *
24 *
365 *
10)),
new X500Name(
"CN=abimaran"),
jcaRequest
.getPublicKey());
JcaX509ExtensionUtils extUtils = new JcaX509ExtensionUtils();
ContentSigner signer =
new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(privateKey);
X509Certificate theCert =
new JcaX509CertificateConverter().setProvider("BC").getCertificate(
certificateBuilder.build(signer));
LOGGER.info("Signed Certificate CN : " + theCert.getSubjectDN().getName());
LOGGER.info("Signed CSR's public key : " + theCert.getPublicKey());
return theCert;
} catch (Exception e) {
throw new Exception("Error in signing the certificate", e);
}
}
}

@ -1,45 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cdm.api.windows.util;
import com.google.gson.JsonObject;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
/**
* WindowsAPIUtil class provides utility function used by Android REST-API classes.
*/
public class WindowsAPIUtil {
public static Device convertToDeviceObject(JsonObject json){
Device device = new Device();
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
device.setName("Test Device");
device.setOwner("harshan");
return device;
}
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId){
DeviceIdentifier identifier = new DeviceIdentifier();
identifier.setId(deviceId);
identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
return identifier;
}
}

@ -1,52 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<context:property-placeholder location="classpath:windows-mdm-server.properties"/>
<bean id="discoveryService" class="cdm.api.windows.impl.DiscoveryServiceImpl">
<property name="discoveryServiceFileName" value="${discovery.service.file.location}"/>
</bean>
<bean id="userEnrollmentService" class="cdm.api.windows.impl.EnrolmentServiceImpl" init-method="init">
<property name="enrollmentResponseFile" value="${enrollment.service.file.location}"/>
<property name="responseFile" value="${policy.certificate.file.location}"/>
<property name="wapProvisioningXmlFile" value="${enrollment.service.wap.provisioning.file.location}"/>
<property name="privatePemKeyFilePath" value="./conf/ca_private.key"/>
<property name="caCertificateFilePath" value="./conf/ca_cert.pem"/>
</bean>
<jaxrs:server name="windowsMDMRest" address="${service.url}">
<jaxrs:serviceBeans>
<ref bean="discoveryService"/>
<ref bean="userEnrollmentService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jaxbProvider"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
</bean>
</beans>

@ -1,20 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDXDCCAkQCCQDWxw0vNF9H8DANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJM
SzEQMA4GA1UECBMHQ29sb21ibzEQMA4GA1UEBxMHQ29sb21ibzENMAsGA1UEChME
d3NvMjEPMA0GA1UECxMGbW9iaWxlMR0wGwYDVQQDFBRjYV93c28yV2luZG93c01v
YmlsZTAeFw0xNDA3MDcxMDE4MDhaFw0xNTA3MDcxMDE4MDhaMHAxCzAJBgNVBAYT
AkxLMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMQ0wCwYDVQQK
EwR3c28yMQ8wDQYDVQQLEwZtb2JpbGUxHTAbBgNVBAMUFGNhX3dzbzJXaW5kb3dz
TW9iaWxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+w93X1S8nOM
VM3ScGP8XY9+PnoUaFZgKaD3d9Z6cj4HPKjIzv8iTMx9JBfDjSsLiks5nJqxm1in
juck7n0tl/CZ5L2j/3DhsA4D0Ngp5JsH5ZF+Vu2T+z8wUq8UwGD6qsn/EP9jBbj/
WN0TtOPcfhOhfJVxaNOrt+9htYad9WOeU8Rh+CIb5oQrigEd417e5d5j4wcU8QLj
sVQQ8WRCYDrnKKof834ZnViBYX4UAdLtXkWFtKcD0RM/cB2LdjydwP3HEj6pkwjT
hRLGHdVF21VCbKOF6mnQagvuseT/ynioBNY60TXb283BQ6YrDfMytvRuzguEQ/7/
AsTPclNZxQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQB3cwy5pibn009WvAYzmw9B
oB77bt21GQO4gFLJlNkvIRrneE5SinjoO6ezWOgY3+8t9ViNeD874momq4kuE6Hb
XDZE1qqinJlqfMJQuEaFkDZKg55kO66wy5+8ioFhA9V8SpeM+SYy3ENBucxiDLQE
ZhM7RKJCpSIq0rRHJyBRbs6GoW7cOB5QQcFDfSW+/CajicWzeD/OJMIfjJezCsZ8
GNXJpyAS/Te+ysHlfmrKMb1VMZphFNiTmpEx8OI8F/kbhmdwePaZ3SOw2kJp8e3v
Ke4/zPwB95wjz8luzU+PbqNO2K4ZKtXHk6rx5yybR1UBpYINvUEjsRI3hgy1IoE+
-----END CERTIFICATE-----

@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAz+w93X1S8nOMVM3ScGP8XY9+PnoUaFZgKaD3d9Z6cj4HPKjI
zv8iTMx9JBfDjSsLiks5nJqxm1injuck7n0tl/CZ5L2j/3DhsA4D0Ngp5JsH5ZF+
Vu2T+z8wUq8UwGD6qsn/EP9jBbj/WN0TtOPcfhOhfJVxaNOrt+9htYad9WOeU8Rh
+CIb5oQrigEd417e5d5j4wcU8QLjsVQQ8WRCYDrnKKof834ZnViBYX4UAdLtXkWF
tKcD0RM/cB2LdjydwP3HEj6pkwjThRLGHdVF21VCbKOF6mnQagvuseT/ynioBNY6
0TXb283BQ6YrDfMytvRuzguEQ/7/AsTPclNZxQIDAQABAoIBAQCrNz+Od1fpnOrv
Hnnu4Pb82F+99Ot/K7mOLiX6Qdyc3KU690Y85m2JTk6yfPsj8VFUdTOg2OXuJWf9
TivkU6JK3u7rJJq6i2rdffz4aji9Lkina1LdJFBacaNKQzBUZsekAiiPB660FK34
sDw9FfIIxAOTwsAb8UoTcgVE5PCIEx7R7YdAI0/mMnd98kTc2YdcnAmGwrDFQNer
eOLhq8H/6SxUADyos3s6Tgw3/yIo9BnBpe8uPNoakEPgYJLh263uF2rJ2h0+yLDV
9F9by+yFCqyVqS8P06NI+NMe8WsYJo99RGQsLZ7PsI5jiJSTRYgOF4ROQfAcCZiK
UWKCwcwhAoGBAPOg32J8AZX64FFDqyruN/1Q6hJfkVAVM+B3dxNAYIpccLuuxJ7x
JMIWkAFfBlOoaXZzxaDIXmXrd3h5qxRTd6W/gAR9nRko7YHaK7NszpEPA8hVOjjx
kkTNs/KjlELrLspRWL+iDqR5Nscw0V9y2D6tyYuGp475wK4PmKbgcKAdAoGBANp7
M9nFEAUTeHzdo9csbrGy6wUuCRlixFvXKOH+1ezeuNvxh0XtbJPj7FrPT4nuCKEV
Wud1w3/IRaeCYeKXaHk6eF8zN1gVkN0MAQJ+9KtfZ0QnmQSsluJfrUBGej6UYO0z
DUv5CLNYLPwOVGTb/jb5n+lY2IzjKmA+aWZRML/JAoGBAJSfUycVVzJTdXydt1Hd
OTLDpcfHnTIpfRg2SOHpp/tAIVWdbD06Bp6QfREZExb96jhkr+9BzLSITL2mG4Ou
15K5nDMhHjE3Eozgt0Ah5HIBouEXfQk39W8bvecLe2rHZifuMCHXju8vMweY9GEy
AlFaW1VOs/E40x5cTVegG5TRAoGANLxmUJtTeZYwkBtDr+2GrpfcSLzK73i6otx1
fs9vPaSpBFXxa/yaJ7xtUaIWtdlh9dfcwF/Zl590yLEdBX+8dP6bDYekRTu3YtPB
7qNMVY1KtNXGBq3OIcgsXoZkfXR9TOP0wrDS289d1F11G39KhmSMp9uNMbynfuGx
uUPBu5kCgYA1UUtQkVPbkKaaopSrDkqAJDlsUnNVkvXH5yWqdAYI2Frw1iOwhED3
cKmwAejf8nl1HPwfDTGQMRB5PCDkK7mWJ5w9W4MUbJ7ZiNPHloZutUTcw3Nz58cn
OZMZGR/Trtn+YLoj2526NPwKqlw0bRB27UR0KOdgPOHynI3uYPnwgQ==
-----END RSA PRIVATE KEY-----

@ -1,27 +0,0 @@
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">
http://schemas.microsoft.com/windows/management/2012/01/enrollment/IDiscoveryService/DiscoverResponse
</a:Action>
<ActivityId>
d9eb2fdd-e38a-46ee-bd93-aea9dc86a3b8
</ActivityId>
<a:RelatesTo>urn:uuid: 748132ec-a575-4329-b01b-6171a9cf8478</a:RelatesTo>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DiscoverResponse
xmlns="http://schemas.microsoft.com/windows/management/2012/01/enrollment">
<DiscoverResult>
<AuthPolicy>OnPremise</AuthPolicy>
<EnrollmentPolicyServiceUrl>
https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc
</EnrollmentPolicyServiceUrl>
<EnrollmentServiceUrl>
https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc
</EnrollmentServiceUrl>
</DiscoverResult>
</DiscoverResponse>
</s:Body>
</s:Envelope>

@ -1,27 +0,0 @@
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<Action s:mustUnderstand="1">http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC/wstep</Action>
<a:RelatesTo>urn:uuid:81a5419a-496b-474f-a627-5cdd33eed8ab</a:RelatesTo>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2012-08-02T00:32:59.420Z</u:Created>
<u:Expires>2014-08-02T00:37:59.420Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<RequestSecurityTokenResponseCollection xmlns="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<RequestSecurityTokenResponse>
<TokenType>http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken</TokenType>
<RequestedSecurityToken>
<BinarySecurityToken ValueType="http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentProvisionDoc"
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary"
xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
</BinarySecurityToken>
</RequestedSecurityToken>
<RequestID xmlns="http://schemas.microsoft.com/windows/pki/2009/01/enrollment">0</RequestID>
</RequestSecurityTokenResponse>
</RequestSecurityTokenResponseCollection>
</s:Body>
</s:Envelope>

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="error" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="logs/windows_mdm_error.log"/>
<param name="Threshold" value="error"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{DATE} %-5p %c{1} - [%x] %m%n"/>
</layout>
</appender>
<appender name="debug" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="logs/windows_mdm_debug.log"/>
<param name="Threshold" value="debug"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{DATE} %-5p %c{1} - [%x] %m%n"/>
</layout>
</appender>
<appender name="trans" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="logs/windows_mdm__trans.log" />
<param name="Threshold" value="info" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
</appender>
<category name="org.apache.cxf" additivity="false">
<priority value="trace"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</category>
<category name="org.springframework" additivity="false">
<priority value="info"/>
<appender-ref ref="error"/>
</category>
<root>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</log4j:configuration>

@ -1,15 +0,0 @@
<s:Envelope
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">
http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPoliciesResponse
</a:Action>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetPoliciesResponse xmlns="http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy">
</GetPoliciesResponse>
</s:Body>
</s:Envelope>

@ -1,3 +1,21 @@
<!--
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<wap-provisioningdoc version="1.1"> <wap-provisioningdoc version="1.1">
<characteristic type="CertificateStore"> <characteristic type="CertificateStore">
<characteristic type="Root"> <characteristic type="Root">

@ -1,8 +0,0 @@
service.url=http://0.0.0.0:9090
discovery.service.file.location=./conf/discover-service.xml
policy.certificate.file.location=./conf/policy-service.xml
enrollment.service.file.location=./conf/enrollment-service.xml
enrollment.service.wap.provisioning.file.location=./conf/wap-provisioning.xml

@ -1,44 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
~ /* ~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. ~
~ * ~ WSO2 Inc. licenses this file to you under the Apache License,
~ * WSO2 Inc. licenses this file to you under the Apache License, ~ Version 2.0 (the "License"); you may not use this file except
~ * Version 2.0 (the "License"); you may not use this file except ~ in compliance with the License.
~ * in compliance with the License. ~ You may obtain a copy of the License at
~ * You may obtain a copy of the License at ~
~ * ~ http://www.apache.org/licenses/LICENSE-2.0
~ * http://www.apache.org/licenses/LICENSE-2.0 ~
~ * ~ Unless required by applicable law or agreed to in writing,
~ * Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an
~ * software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the
~ * KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations
~ * specific language governing permissions and limitations ~ under the License.
~ * under the License.
~ */
--> -->
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="ServiceDiscoveryService" address="/devices"> <jaxws:endpoint
<jaxrs:serviceBeans> id="DiscoveryService"
<ref bean="ServiceDiscoveryServiceBean"/> implementor="cdm.api.windows.DiscoveryService.impl.DiscoveryServiceGetImpl"
</jaxrs:serviceBeans> address="/test/send"/>
</jaxrs:server>
<jaxrs:server id="enrollmentService" address="/enrollment"> <jaxrs:server id="DiscoveryService_rest" address="/test/send2">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="enrollmentServiceBean"/> <ref bean="DiscoveryService_rest_bean"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
</jaxrs:server> </jaxrs:server>
<bean id="ServiceDiscoveryServiceBean" class="cdm.api.windows.impl.DiscoveryServiceImpl"/> <bean id="DiscoveryService_rest_bean" class="cdm.api.windows.DiscoveryService.impl.DiscoveryServiceGetImpl"/>
<bean id="enrollmentServiceBean" class="cdm.api.windows.impl.EnrolmentServiceImpl"/>
<jaxws:endpoint
id="EnrollmentPolicyService"
implementor="cdm.api.windows.xcep.impl.xcepimpl"
address="/test/xcep">
<jaxws:inInterceptors>
<ref bean="wss4jInInterceptor1"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="wss4jInInterceptor1" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties">
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordText"/>
<entry key="isBSPCompliant" value="false"/>
<entry key="allowNamespaceQualifiedPasswordTypes"
value="true"/>
<entry key="passwordCallbackRef" value-ref="passwordCallback1"/>
</map>
</property>
</bean>
<bean id="passwordCallback1" class="cdm.api.windows.xcep.util.ServerPasswordCallback"/>
<jaxws:endpoint
id="CertificateEnrollmentService"
implementor="cdm.api.windows.wstep.impl.CertificateEnrollmentServiceImpl"
address="/cert">
<jaxws:inInterceptors>
<ref bean="wss4jInInterceptor2"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="wss4jInInterceptor2" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties">
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordText"/>
<entry key="isBSPCompliant" value="false"/>
<entry key="allowNamespaceQualifiedPasswordTypes"
value="true"/>
<entry key="passwordCallbackRef" value-ref="passwordCallback2"/>
</map>
</property>
</bean>
<bean id="passwordCallback2" class="cdm.api.windows.wstep.util.PasswordCallbackHandler"/>
</beans> </beans>

@ -20,10 +20,16 @@
--> -->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>CDM-Windows-API</display-name> <display-name>CDM-Windows-API</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/cxf-servlet.xml</param-value>
</context-param>
<servlet> <servlet>
<description>JAX-WS/JAX-RS Endpoint</description> <description>JAX-WS/JAX-RS-windows Endpoint</description>
<display-name>JAX-WS/JAX-RS Servlet</display-name> <display-name>JAX-WS/JAX-RS-windows Servlet</display-name>
<servlet-name>JAXServlet</servlet-name> <servlet-name>JAXServlet-windows</servlet-name>
<servlet-class> <servlet-class>
org.apache.cxf.transport.servlet.CXFServlet org.apache.cxf.transport.servlet.CXFServlet
</servlet-class> </servlet-class>
@ -34,7 +40,7 @@
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>JAXServlet</servlet-name> <servlet-name>JAXServlet-windows</servlet-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<session-config> <session-config>

@ -1,117 +0,0 @@
@CHARSET "ISO-8859-1";
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
html {
background: #efefef;
}
body {
line-height: 1;
width:960px;
margin:auto;
background:white;
padding:10px;
box-shadow:0px 0px 5px #CCC;
font-family:"Lucida Grande","Lucida Sans","Microsoft Sans Serif", "Lucida Sans Unicode","Verdana","Sans-serif","trebuchet ms" !important;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
width:960px;
border:solid 1px #ccc;
}
table a {
font-size:12px;
color:#1e90ff;
padding:7px;
float:left;
;
}
.heading {
font-size: 18px;
margin-top: 20px;
float:left;
color:#0067B1;
margin-bottom:20px;
padding-top:20px;
}
.field {
font-weight: normal;
width:120px;
font-size:12px;
float:left;
padding:7px;
clear:left;
}
.value {
font-weight: bold;
font-size:12px;
float:left;
padding:7px;
clear:right;
}
.porttypename {
font-weight: bold;
font-size:14px;
}
UL {
margin-top: 0;
}
LI {
font-weight: normal;
font-size:12px;
margin-top:10px;
}
TD {
border:1px solid #ccc;
vertical-align: text-top;
padding: 5px;
}
Loading…
Cancel
Save