From eb52073e37c4becbf354442b8cdcdebacd57a4f6 Mon Sep 17 00:00:00 2001 From: asok Date: Wed, 21 Jan 2015 16:29:24 +0530 Subject: [PATCH 1/3] commiting windows plugin --- .../agents/windows/jax-rs/build.xml | 75 ----- .../agents/windows/jax-rs/pom.xml | 62 ++-- .../agents/windows/jax-rs/run-client.bat | 81 ----- .../agents/windows/jax-rs/run-client.sh | 90 ------ .../cdm/api/windows/DiscoveryService.java | 47 --- .../cdm/api/windows/EnrolmentService.java | 43 --- .../windows/impl/DiscoveryServiceImpl.java | 72 ----- .../windows/impl/EnrolmentServiceImpl.java | 305 ------------------ .../util/CertificateSigningService.java | 92 ------ .../cdm/api/windows/util/WindowsAPIUtil.java | 45 --- .../src/main/resources/applicationContext.xml | 52 --- .../jax-rs/src/main/resources/ca_cert.pem | 20 -- .../jax-rs/src/main/resources/ca_private.key | 27 -- .../src/main/resources/discover-service.xml | 27 -- .../src/main/resources/enrollment-service.xml | 27 -- .../jax-rs/src/main/resources/log4j.xml | 50 --- .../src/main/resources/policy-service.xml | 15 - .../src/main/resources/wap-provisioning.xml | 18 ++ .../resources/windows-mdm-server.properties | 8 - .../src/main/webapp/WEB-INF/cxf-servlet.xml | 109 +++++-- .../jax-rs/src/main/webapp/WEB-INF/web.xml | 14 +- .../jax-rs/src/main/webapp/servicelist.css | 117 ------- 22 files changed, 133 insertions(+), 1263 deletions(-) delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/build.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/run-client.bat delete mode 100755 product/modules/mobileservices/agents/windows/jax-rs/run-client.sh delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/applicationContext.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_cert.pem delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_private.key delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/discover-service.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/enrollment-service.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/log4j.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/policy-service.xml delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties delete mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/servicelist.css diff --git a/product/modules/mobileservices/agents/windows/jax-rs/build.xml b/product/modules/mobileservices/agents/windows/jax-rs/build.xml deleted file mode 100644 index fe8e11092d..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/product/modules/mobileservices/agents/windows/jax-rs/pom.xml b/product/modules/mobileservices/agents/windows/jax-rs/pom.xml index e0c51bde96..8f9ab89a7a 100644 --- a/product/modules/mobileservices/agents/windows/jax-rs/pom.xml +++ b/product/modules/mobileservices/agents/windows/jax-rs/pom.xml @@ -1,18 +1,20 @@ + ~ 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. +--> 4.0.0 org.wso2.carbon - cdm-windows-api - JAX-RS Windows API - JAX-RS Windows API + cdm-android-api + JAX-RS Android API + JAX-RS Android API war @@ -127,23 +129,11 @@ junit test - - commons-httpclient - commons-httpclient - 3.1 - provided - javax.ws.rs jsr311-api - 1.1.1 provided - - com.google.code.gson - gson - 2.2.4 - org.wso2.carbon org.wso2.carbon.utils @@ -152,13 +142,11 @@ org.wso2.carbon org.wso2.carbon.device.mgt.common - 2.0.0-SNAPSHOT provided org.wso2.carbon org.wso2.carbon.device.mgt.core - 2.0.0-SNAPSHOT provided @@ -167,24 +155,18 @@ provided - log4j - log4j - 1.2.17 + org.apache.wss4j + wss4j-ws-security-common + 2.0.0 - org.bouncycastle - bcpkix-jdk15on - 1.49 + org.apache.cxf + cxf-rt-ws-security + 2.6.1 - org.bouncycastle - bcprov-jdk15on - 1.49 + org.codehaus.jackson + jackson-jaxrs - - 2.6.1 - 4.8.2 - - diff --git a/product/modules/mobileservices/agents/windows/jax-rs/run-client.bat b/product/modules/mobileservices/agents/windows/jax-rs/run-client.bat deleted file mode 100644 index 9bd370256d..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/run-client.bat +++ /dev/null @@ -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 diff --git a/product/modules/mobileservices/agents/windows/jax-rs/run-client.sh b/product/modules/mobileservices/agents/windows/jax-rs/run-client.sh deleted file mode 100755 index 279d5023c0..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/run-client.sh +++ /dev/null @@ -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$* diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java deleted file mode 100644 index 64cd0e8ecb..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java +++ /dev/null @@ -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); - -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java deleted file mode 100644 index 9a61a3c61d..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java +++ /dev/null @@ -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); - -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java deleted file mode 100644 index 59de66ae0f..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java +++ /dev/null @@ -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(); - } - - -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java deleted file mode 100644 index c3acde8387..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java +++ /dev/null @@ -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; - } - } -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java deleted file mode 100644 index 6b00694097..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java +++ /dev/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); - } - } - -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java deleted file mode 100644 index ca784e1895..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java +++ /dev/null @@ -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; - } -} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/applicationContext.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/applicationContext.xml deleted file mode 100644 index 5dd63f2c88..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_cert.pem b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_cert.pem deleted file mode 100644 index 6eaad0f570..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_cert.pem +++ /dev/null @@ -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----- diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_private.key b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_private.key deleted file mode 100644 index 764b316630..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/ca_private.key +++ /dev/null @@ -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----- diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/discover-service.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/discover-service.xml deleted file mode 100644 index 05f8f939b9..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/discover-service.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - http://schemas.microsoft.com/windows/management/2012/01/enrollment/IDiscoveryService/DiscoverResponse - - - d9eb2fdd-e38a-46ee-bd93-aea9dc86a3b8 - - urn:uuid: 748132ec-a575-4329-b01b-6171a9cf8478 - - - - - OnPremise - - https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc - - - https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc - - - - - \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/enrollment-service.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/enrollment-service.xml deleted file mode 100644 index 4be6e477ac..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/enrollment-service.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC/wstep - urn:uuid:81a5419a-496b-474f-a627-5cdd33eed8ab - - - 2012-08-02T00:32:59.420Z - 2014-08-02T00:37:59.420Z - - - - - - - http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken - - - - - 0 - - - - \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/log4j.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/log4j.xml deleted file mode 100644 index 7cd7d64125..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/log4j.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/policy-service.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/policy-service.xml deleted file mode 100644 index e38440d6bd..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/policy-service.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPoliciesResponse - - - - - - - - \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml index d51958a715..7683a22c1e 100644 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml @@ -1,3 +1,21 @@ + + diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties b/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties deleted file mode 100644 index 6f092e31fb..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties +++ /dev/null @@ -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 \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml index 165c967047..532caed718 100644 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -1,44 +1,101 @@ - - - - - - + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml b/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml index 777ee8a709..c36bac34d5 100644 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml @@ -20,10 +20,16 @@ --> CDM-Windows-API + + + contextConfigLocation + /WEB-INF/cxf-servlet.xml + + - JAX-WS/JAX-RS Endpoint - JAX-WS/JAX-RS Servlet - JAXServlet + JAX-WS/JAX-RS-windows Endpoint + JAX-WS/JAX-RS-windows Servlet + JAXServlet-windows org.apache.cxf.transport.servlet.CXFServlet @@ -34,7 +40,7 @@ 1 - JAXServlet + JAXServlet-windows /* diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/servicelist.css b/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/servicelist.css deleted file mode 100644 index bbc4987c0a..0000000000 --- a/product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/servicelist.css +++ /dev/null @@ -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; -} - - From ebe0aa2663d476bbfcfa6fa1615b62729d17f895 Mon Sep 17 00:00:00 2001 From: asok Date: Wed, 21 Jan 2015 16:34:03 +0530 Subject: [PATCH 2/3] commiting windows plugin --- .../DiscoveryService/DiscoveryServiceGet.java | 52 ++ .../beans/in/DiscoveryRequest.java | 61 +++ .../beans/in/package-info.java | 24 + .../DiscoveryService/beans/out/Message.java | 58 +++ .../impl/DiscoveryServiceGetImpl.java | 64 +++ .../wstep/CertificateEnrollmentService.java | 54 ++ .../wstep/beans/AdditionalContext.java | 45 ++ .../wstep/beans/BinarySecurityToken.java | 60 +++ .../api/windows/wstep/beans/ContextItem.java | 43 ++ .../wstep/beans/RequestSecurityToken.java | 40 ++ .../beans/RequestSecurityTokenResponse.java | 71 +++ .../wstep/beans/RequestedSecurityToken.java | 45 ++ .../api/windows/wstep/beans/package-info.java | 27 + .../CertificateEnrollmentServiceImpl.java | 195 +++++++ .../wstep/util/ApkGenerationException.java | 36 ++ .../wstep/util/CertificateSigningService.java | 104 ++++ .../windows/wstep/util/CertificateUtil.java | 77 +++ .../cdm/api/windows/wstep/util/Constants.java | 117 +++++ .../api/windows/wstep/util/FileOperator.java | 195 +++++++ .../windows/wstep/util/KeyStoreGenerator.java | 94 ++++ .../wstep/util/PPSRSOApMessageHandler.java | 57 ++ .../wstep/util/PasswordCallbackHandler.java | 42 ++ .../java/cdm/api/windows/xcep/IPolicy.java | 48 ++ .../api/windows/xcep/beans/Attributes.java | 489 ++++++++++++++++++ .../java/cdm/api/windows/xcep/beans/CA.java | 165 ++++++ .../api/windows/xcep/beans/CACollection.java | 69 +++ .../xcep/beans/CAReferenceCollection.java | 69 +++ .../cdm/api/windows/xcep/beans/CAURI.java | 170 ++++++ .../windows/xcep/beans/CAURICollection.java | 69 +++ .../beans/CertificateEnrollmentPolicy.java | 147 ++++++ .../xcep/beans/CertificateValidity.java | 94 ++++ .../cdm/api/windows/xcep/beans/Client.java | 135 +++++ .../windows/xcep/beans/CryptoProviders.java | 69 +++ .../xcep/beans/EnrollmentPermission.java | 71 +++ .../cdm/api/windows/xcep/beans/Extension.java | 99 ++++ .../xcep/beans/ExtensionCollection.java | 69 +++ .../xcep/beans/FilterOIDCollection.java | 69 +++ .../api/windows/xcep/beans/GetPolicies.java | 92 ++++ .../xcep/beans/GetPoliciesResponse.java | 120 +++++ .../xcep/beans/KeyArchivalAttributes.java | 73 +++ .../java/cdm/api/windows/xcep/beans/OID.java | 169 ++++++ .../api/windows/xcep/beans/OIDCollection.java | 69 +++ .../xcep/beans/OIDReferenceCollection.java | 69 +++ .../api/windows/xcep/beans/ObjectFactory.java | 261 ++++++++++ .../windows/xcep/beans/PolicyCollection.java | 69 +++ .../xcep/beans/PrivateKeyAttributes.java | 197 +++++++ .../windows/xcep/beans/RARequirements.java | 112 ++++ .../api/windows/xcep/beans/RequestFilter.java | 100 ++++ .../cdm/api/windows/xcep/beans/Response.java | 214 ++++++++ .../cdm/api/windows/xcep/beans/Revision.java | 74 +++ .../xcep/beans/SupersededPolicies.java | 69 +++ .../api/windows/xcep/beans/package-info.java | 2 + .../cdm/api/windows/xcep/impl/xcepimpl.java | 79 +++ .../xcep/util/PPSRSOApMessageHandler.java | 58 +++ .../xcep/util/ServerPasswordCallback.java | 40 ++ 55 files changed, 5260 insertions(+) create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/DiscoveryServiceGet.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/DiscoveryRequest.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/package-info.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/out/Message.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/impl/DiscoveryServiceGetImpl.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/CertificateEnrollmentService.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/AdditionalContext.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/BinarySecurityToken.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/ContextItem.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityToken.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityTokenResponse.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestedSecurityToken.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/package-info.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/impl/CertificateEnrollmentServiceImpl.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/ApkGenerationException.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateSigningService.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateUtil.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/Constants.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/FileOperator.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/KeyStoreGenerator.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PPSRSOApMessageHandler.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PasswordCallbackHandler.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/IPolicy.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Attributes.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CA.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CACollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAReferenceCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURI.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURICollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateEnrollmentPolicy.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateValidity.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Client.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CryptoProviders.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/EnrollmentPermission.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Extension.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ExtensionCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/FilterOIDCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPolicies.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPoliciesResponse.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/KeyArchivalAttributes.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OID.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDReferenceCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ObjectFactory.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PolicyCollection.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PrivateKeyAttributes.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RARequirements.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RequestFilter.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Response.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Revision.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/SupersededPolicies.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/package-info.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/impl/xcepimpl.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/PPSRSOApMessageHandler.java create mode 100644 product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/ServerPasswordCallback.java diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/DiscoveryServiceGet.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/DiscoveryServiceGet.java new file mode 100644 index 0000000000..5395251a1b --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/DiscoveryServiceGet.java @@ -0,0 +1,52 @@ +/* + * 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.DiscoveryService; + + +import cdm.api.windows.DiscoveryService.beans.in.DiscoveryRequest; +import cdm.api.windows.DiscoveryService.beans.out.Message; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.xml.ws.BindingType; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import javax.xml.ws.soap.SOAPBinding; + +@WebService(targetNamespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment", name = "IDiscoveryService") +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +public interface DiscoveryServiceGet { + + @POST + @WebMethod(operationName = "Discover") + @RequestWrapper(targetNamespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") + @ResponseWrapper(targetNamespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") + @WebResult(name = "DiscoverResult") Message Discover( + @WebParam(name = "request") + DiscoveryRequest request); + + @GET + @WebMethod + @WebResult() Response DiscoverGet(); + +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/DiscoveryRequest.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/DiscoveryRequest.java new file mode 100644 index 0000000000..825f51a379 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/DiscoveryRequest.java @@ -0,0 +1,61 @@ +/* + * 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.DiscoveryService.beans.in; + + +import javax.xml.bind.annotation.*; +import java.io.Serializable; + +@XmlRootElement +@XmlAccessorType(XmlAccessType.FIELD) +public class DiscoveryRequest implements Serializable { + + @XmlElement(name = "EmailAddress") + private String emailId; + + @XmlElement(name = "RequestVersion") + private String version; + + @XmlElement(name = "DeviceType") + private String deviceType; + + public String getEmailId() { + return emailId; + } + + public String getVersion() { + return version; + } + + public void setEmailId(String emailId) { + this.emailId = emailId; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/package-info.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/package-info.java new file mode 100644 index 0000000000..7f21ab9ee1 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/in/package-info.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + + + + + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollment", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package cdm.api.windows.DiscoveryService.beans.in; diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/out/Message.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/out/Message.java new file mode 100644 index 0000000000..8cc1d8f7a4 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/beans/out/Message.java @@ -0,0 +1,58 @@ +/* + * 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.DiscoveryService.beans.out; + +import javax.xml.bind.annotation.*; +import java.io.Serializable; + + +@XmlRootElement +public class Message implements Serializable { + + private String authPolicy; + private String enrollmentPolicyServiceUrl; + private String enrollmentServiceUrl; + + @XmlElement(name = "AuthPolicy", namespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") + public String getAuthPolicy() { + return authPolicy; + } + + @XmlElement(name = "EnrollmentPolicyServiceUrl", namespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") + public String getEnrollmentPolicyServiceUrl() { + return enrollmentPolicyServiceUrl; + } + + @XmlElement(name = "EnrollmentServiceUrl", namespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") + public String getEnrollmentServiceUrl() { + return enrollmentServiceUrl; + } + + public void setAuthPolicy(String authPolicy) { + this.authPolicy = authPolicy; + } + + public void setEnrollmentPolicyServiceUrl(String enrollmentPolicyServiceUrl) { + this.enrollmentPolicyServiceUrl = enrollmentPolicyServiceUrl; + } + + public void setEnrollmentServiceUrl(String enrollmentServiceUrl) { + this.enrollmentServiceUrl = enrollmentServiceUrl; + } +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/impl/DiscoveryServiceGetImpl.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/impl/DiscoveryServiceGetImpl.java new file mode 100644 index 0000000000..70c6e79ef0 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService/impl/DiscoveryServiceGetImpl.java @@ -0,0 +1,64 @@ +/* + * 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.DiscoveryService.impl; + +import cdm.api.windows.DiscoveryService.beans.in.DiscoveryRequest; +import cdm.api.windows.DiscoveryService.DiscoveryServiceGet; +import cdm.api.windows.DiscoveryService.beans.out.Message; +import org.apache.log4j.Logger; +import javax.jws.WebService; +import javax.ws.rs.core.Response; +import javax.xml.ws.BindingType; +import javax.xml.ws.soap.Addressing; +import javax.xml.ws.soap.SOAPBinding; + +@WebService(endpointInterface = "cdm.api.windows.DiscoveryService.DiscoveryServiceGet", targetNamespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") +@Addressing(enabled = true, required = true) +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +public class DiscoveryServiceGetImpl implements DiscoveryServiceGet { + + private Logger LOGGER = Logger.getLogger(DiscoveryServiceGetImpl.class); + + @Override + public Message Discover(DiscoveryRequest disRequest) { + + System.out.println("CHECK_SECOND_POST"); + + Message message = new Message(); + message.setAuthPolicy("OnPremise"); + + message.setEnrollmentPolicyServiceUrl( + "https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc"); + message.setEnrollmentServiceUrl( + "https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc"); + + LOGGER.info("Received Discovery Service Request"); + + return message; + } + + @Override + public Response DiscoverGet() { + + System.out.println("CHECK_FIRST_GET"); + + return Response.ok().build(); + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/CertificateEnrollmentService.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/CertificateEnrollmentService.java new file mode 100644 index 0000000000..9fb6eb629a --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/CertificateEnrollmentService.java @@ -0,0 +1,54 @@ +/* + * 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.wstep; + +import cdm.api.windows.wstep.beans.RequestSecurityTokenResponse; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.ws.rs.*; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import javax.xml.ws.soap.SOAPBinding; +import javax.xml.ws.BindingType; + +@WebService(targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC", name = "wstep") +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +public interface CertificateEnrollmentService { + + @RequestWrapper(localName = "RequestSecurityToken", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + @WebMethod(operationName = "RequestSecurityToken") + @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + public void RequestSecurityToken( + @WebParam(name = "TokenType", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + String TokenType, + @WebParam(name = "RequestType", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + String RequestType, + @WebParam(name = "BinarySecurityToken", targetNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") + String BinarySecurityToken, + @WebParam(name = "AdditionalContext", targetNamespace = "http://schemas.xmlsoap.org/ws/2006/12/authorization") + cdm.api.windows.wstep.beans.AdditionalContext AdditionalContext, + @WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + javax.xml.ws.Holder response + ); + +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/AdditionalContext.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/AdditionalContext.java new file mode 100644 index 0000000000..8ffc134ff0 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/AdditionalContext.java @@ -0,0 +1,45 @@ +/* + * 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.wstep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OIDCollection", namespace = "http://schemas.xmlsoap.org/ws/2006/12/authorization", propOrder = { + "contextitem" +}) +public class AdditionalContext { + + @XmlElement(name = "ContextItem", required = true) + protected List contextitem; + + public List getcontextitem() { + if (contextitem == null) { + contextitem = new ArrayList(); + } + return this.contextitem; + } + +} + diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/BinarySecurityToken.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/BinarySecurityToken.java new file mode 100644 index 0000000000..9f84e905ed --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/BinarySecurityToken.java @@ -0,0 +1,60 @@ +/* + * 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.wstep.beans; + +import javax.xml.bind.annotation.*; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BinarySecurityToken", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") +public class BinarySecurityToken { + + @XmlAttribute(name = "ValueType") + protected String ValueType; + @XmlAttribute(name = "EncodingType") + protected String EncodingType; + + @XmlValue + protected String Token; + + public void setValueType(String valuetype) { + this.ValueType = valuetype; + } + + public String getValueType() { + return this.ValueType; + } + + public void setEncodingType(String encodingtype) { + this.EncodingType = encodingtype; + } + + public String getEncodingType() { + return this.EncodingType; + } + + public void setToken(String token) { + this.Token = token; + } + + public String getToken() { + return this.Token; + } + +} + diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/ContextItem.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/ContextItem.java new file mode 100644 index 0000000000..84df970622 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/ContextItem.java @@ -0,0 +1,43 @@ +/* + * 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.wstep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ContextItem", namespace = "http://schemas.xmlsoap.org/ws/2006/12/authorization", propOrder = { + "Value" +}) +public class ContextItem { + + @XmlElement(required = true) + protected String Value; + + public String getValue() { + return Value; + } + + public void setValue(String value) { + Value = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityToken.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityToken.java new file mode 100644 index 0000000000..e964e6f573 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityToken.java @@ -0,0 +1,40 @@ +/* + * 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.wstep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestedSecurityToken", namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512", propOrder = { + "binarySecurityToken" +}) +public class RequestSecurityToken { + + @XmlElement(name = "BinarySecurityToken", required = true, namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") + + protected BinarySecurityToken binarySecurityToken; + + public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { + this.binarySecurityToken = binarysecuritytoken; + } + +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityTokenResponse.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityTokenResponse.java new file mode 100644 index 0000000000..48d3a95d0b --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestSecurityTokenResponse.java @@ -0,0 +1,71 @@ +/* + * 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.wstep.beans; + +import cdm.api.windows.wstep.beans.AdditionalContext; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestSecurityTokenResponse", namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512", propOrder = { + "TokenType", + "RequestedSecurityToken", + "RequestID" +}) +public class RequestSecurityTokenResponse implements Serializable { + + @XmlElement(name = "TokenType", namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + private String TokenType; + + @XmlElement(name = "RequestedSecurityToken", required = true, namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + private RequestedSecurityToken RequestedSecurityToken; + + @XmlElement(name = "RequestID", namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512") + private int RequestID; + + public String getTokenType() { + return TokenType; + } + + public void setTokenType(String tokenType) { + TokenType = tokenType; + } + + public RequestedSecurityToken getRequestedSecurityToken() { + return RequestedSecurityToken; + } + + public void setRequestedSecurityToken(RequestedSecurityToken requestedSecurityToken) { + RequestedSecurityToken = requestedSecurityToken; + } + + public int getRequestID() { + return RequestID; + } + + public void setRequestID(int requestID) { + RequestID = requestID; + } +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestedSecurityToken.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestedSecurityToken.java new file mode 100644 index 0000000000..b85ae85aac --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/RequestedSecurityToken.java @@ -0,0 +1,45 @@ +/* + * 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.wstep.beans; + +import cdm.api.windows.wstep.beans.ContextItem; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestedSecurityToken", namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512", propOrder = { + "binarySecurityToken" +}) +public class RequestedSecurityToken { + + @XmlElement(name = "BinarySecurityToken", required = true, namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") + + protected BinarySecurityToken binarySecurityToken; + + public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { + this.binarySecurityToken = binarysecuritytoken; + } + +} + diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/package-info.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/package-info.java new file mode 100644 index 0000000000..453eefdd21 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/beans/package-info.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +@XmlSchema(namespace = "http://www.w3.org/2003/05/soap-envelope", + xmlns = { + @XmlNs(prefix = "", namespaceURI = "http://www.w3.org/2003/05/soap-envelope"), + }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) + +package com.ex.wstep; + +import javax.xml.bind.annotation.XmlNs; +import javax.xml.bind.annotation.XmlSchema; \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/impl/CertificateEnrollmentServiceImpl.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/impl/CertificateEnrollmentServiceImpl.java new file mode 100644 index 0000000000..32f8c35dcb --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/impl/CertificateEnrollmentServiceImpl.java @@ -0,0 +1,195 @@ +/* + * 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.wstep.impl; + +import cdm.api.windows.wstep.beans.AdditionalContext; +import cdm.api.windows.wstep.CertificateEnrollmentService; +import cdm.api.windows.wstep.beans.BinarySecurityToken; +import javax.jws.WebService; +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.ws.BindingType; +import javax.xml.ws.Holder; +import javax.xml.ws.soap.Addressing; +import javax.xml.ws.soap.SOAPBinding; +import org.apache.commons.codec.digest.DigestUtils; +import cdm.api.windows.wstep.beans.RequestSecurityTokenResponse; +import cdm.api.windows.wstep.beans.RequestedSecurityToken; +import cdm.api.windows.wstep.util.CertificateSigningService; +import cdm.api.windows.wstep.util.KeyStoreGenerator; +import org.apache.log4j.Logger; +import org.bouncycastle.pkcs.PKCS10CertificationRequest; +import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import sun.misc.BASE64Encoder; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.StringWriter; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + +@WebService(endpointInterface = "cdm.api.windows.wstep.CertificateEnrollmentService", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC") +@Addressing(enabled = true, required = true) +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentService { + + private Logger LOGGER = Logger.getLogger(CertificateEnrollmentServiceImpl.class); + + PrivateKey privateKey; + X509Certificate rooCACertificate; + JcaPKCS10CertificationRequest csrReq; + PKCS10CertificationRequest certificationRequest; + + String wapProvisioningXmlFile; + DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + + @Override public void RequestSecurityToken(String TokenType, String RequestType, + String BinarySecurityToken, + AdditionalContext AdditionalContext, + Holder response) { + + certificateSign(); + ////////// + System.out.println("\n\n\n"+"REQUEST_CSR:"+BinarySecurityToken+"\n\n\n"); + ////////// + + File file = new File(getClass().getClassLoader().getResource("wap-provisioning.xml").getFile()); + wapProvisioningXmlFile = file.getPath(); + + String encodedWap="Initial_test"; + + RequestSecurityTokenResponse rs = new RequestSecurityTokenResponse(); + rs.setTokenType( + "http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken"); + + try { + byte[] derByteArray = javax.xml.bind.DatatypeConverter.parseBase64Binary(BinarySecurityToken); + certificationRequest = new PKCS10CertificationRequest(derByteArray); + csrReq = new JcaPKCS10CertificationRequest(certificationRequest); + + X509Certificate signedCert = CertificateSigningService.signCSR(csrReq, privateKey, rooCACertificate); + + System.out.println("PUBLIC KEY OF SIGNED CERT :"+signedCert.getPublicKey()+"\n\n\n"); + System.out.println("PUBLIC KEY OF CSR :"+csrReq.getPublicKey()+"\n\n\n"); + + + + BASE64Encoder base64Encoder = new BASE64Encoder(); + String rootCertEncodedString = base64Encoder.encode(rooCACertificate.getEncoded()); + String signedCertEncoded = base64Encoder.encode(signedCert.getEncoded()); + + DocumentBuilder builder = domFactory.newDocumentBuilder(); + Document dDoc = builder.parse(wapProvisioningXmlFile); + + NodeList wapParm = dDoc.getElementsByTagName("parm"); + ///////// + wapParm.item(0).getParentNode().getAttributes().getNamedItem("type").setTextContent(String.valueOf( + DigestUtils.sha1Hex(rooCACertificate.getEncoded()))); + ///////// + NamedNodeMap rootCertAttributes = wapParm.item(0).getAttributes(); + Node b64Encoded = rootCertAttributes.getNamedItem("value"); + rootCertEncodedString=rootCertEncodedString.replaceAll("\n",""); + b64Encoded.setTextContent(rootCertEncodedString); + System.out.println("COPY_ROOT_CERT:"+rootCertEncodedString); + + ///////// + wapParm.item(1).getParentNode().getAttributes().getNamedItem("type").setTextContent(String.valueOf(DigestUtils.sha1Hex(signedCert.getEncoded()))); + ///////// + + + + NamedNodeMap clientCertAttributes = wapParm.item(1).getAttributes(); + Node b64CliendEncoded = clientCertAttributes.getNamedItem("value"); + signedCertEncoded=signedCertEncoded.replaceAll("\n",""); + b64CliendEncoded.setTextContent(signedCertEncoded); + System.out.println("COPY_SIGNED_CERT:"+signedCertEncoded); + + + String wapProvisioning = convertDocumentToString(dDoc); + + /////// + System.out.println("WAP_XML:"+wapProvisioning+"\n\n\n"); + /////// + + encodedWap = base64Encoder.encode(wapProvisioning.getBytes()); + + } catch (Exception e) { + //throw + } + + RequestedSecurityToken rst = new RequestedSecurityToken(); + BinarySecurityToken BinarySecToken=new BinarySecurityToken(); + BinarySecToken.setValueType("http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentProvisionDoc"); + BinarySecToken.setEncodingType( + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary"); + BinarySecToken.setToken(encodedWap); + rst.setBinarySecurityToken(BinarySecToken); + + rs.setRequestedSecurityToken(rst); + rs.setRequestID(0); + response.value = rs; + + } + + private String convertDocumentToString(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 certificateSign() { + + try { + KeyStore securityJks = KeyStoreGenerator.getKeyStore(); + String pass = "wso2carbon"; + KeyStoreGenerator.loadToStore(securityJks, pass.toCharArray(), "/Users/asok/Downloads/wso2as-5.2.1/repository/resources/security/wso2carbon.jks"); + PrivateKey privateKeyCA = (PrivateKey) securityJks.getKey("wso2carbon", pass.toCharArray()); + + privateKey=privateKeyCA; + + Certificate cartificateCA = securityJks.getCertificate(pass); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + ByteArrayInputStream bais = new ByteArrayInputStream(cartificateCA.getEncoded()); + X509Certificate cartificateCAX509 = (X509Certificate) cf.generateCertificate(bais); + + rooCACertificate=cartificateCAX509; + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/ApkGenerationException.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/ApkGenerationException.java new file mode 100644 index 0000000000..0c7d2768fc --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/ApkGenerationException.java @@ -0,0 +1,36 @@ +/* + * 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.wstep.util; + + +/** + * Custom exception handling class, to handle the issue that come up during + * execution of Apk and certificate generation. + */ +public class ApkGenerationException extends Exception { + + public ApkGenerationException(String message) { + super(message); + } + + public ApkGenerationException(String message, Throwable e) { + super(message, e); + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateSigningService.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateSigningService.java new file mode 100644 index 0000000000..75d45c5e85 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateSigningService.java @@ -0,0 +1,104 @@ +package cdm.api.windows.wstep.util; + +//REMOVE THIS LATER + +import org.apache.log4j.Logger; +import org.bouncycastle.asn1.x500.X500Name; +import org.bouncycastle.asn1.x509.*; +import org.bouncycastle.cert.X509CertificateHolder; +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.crypto.params.AsymmetricKeyParameter; +import org.bouncycastle.crypto.util.PrivateKeyFactory; +import org.bouncycastle.jce.PKCS10CertificationRequest; +import org.bouncycastle.operator.ContentSigner; +import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder; +import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder; +import org.bouncycastle.operator.OperatorCreationException; +import org.bouncycastle.operator.bc.BcRSAContentSignerBuilder; +import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; +//import org.bouncycastle.pkcs.PKCS10CertificationRequestHolder; +import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; + + + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Date; + +public class CertificateSigningService { + + private static Logger LOGGER = Logger.getLogger(CertificateSigningService.class); + + /*public static X509Certificate sign(PKCS10CertificationRequest inputCSR, PrivateKey caPrivate, X509Certificate caCertificate) + throws InvalidKeyException, NoSuchAlgorithmException,NoSuchProviderException, SignatureException, IOException, + OperatorCreationException, CertificateException { + + AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA1withRSA"); + AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId); + + AsymmetricKeyParameter foo = PrivateKeyFactory.createKey(caPrivate.getEncoded()); + + //SubjectPublicKeyInfo keyInfo = SubjectPublicKeyInfo.getInstance(pair.getPublic().getEncoded()); + + PKCS10CertificationRequestHolder pk10Holder = new PKCS10CertificationRequestHolder(inputCSR); + SubjectPublicKeyInfo csrKeyInfo = pk10Holder.getSubjectPublicKeyInfo(); + + LOGGER.info("CN of the Device's CSR : " + pk10Holder.getSubject().toString()); + + + X509v3CertificateBuilder myCertificateGenerator = new X509v3CertificateBuilder( + new X500Name(caCertificate.getIssuerX500Principal().getName()), 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"), csrKeyInfo); + + ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId).build(foo); + + X509CertificateHolder holder = myCertificateGenerator.build(sigGen); + X509CertificateStructure eeX509CertificateStructure = holder.toASN1Structure(); + + CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC"); + + // Read Certificate + InputStream is1 = new ByteArrayInputStream(eeX509CertificateStructure.getEncoded()); + X509Certificate theCert = (X509Certificate) cf.generateCertificate(is1); + + LOGGER.info("Signed Certificate CN : " + theCert.getSubjectDN().getName()); + + LOGGER.info("Signed CSR's public key : " + theCert.getPublicKey()); + + is1.close(); + return theCert; + }*/ + + 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); + } + } +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateUtil.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateUtil.java new file mode 100644 index 0000000000..1c3424e577 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/CertificateUtil.java @@ -0,0 +1,77 @@ +/* + * 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.wstep.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +import java.math.BigInteger; + +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Date; +import org.spongycastle.asn1.x500.X500Name; +import org.spongycastle.cert.X509v3CertificateBuilder; +import org.spongycastle.cert.jcajce.JcaX509CertificateConverter; +import org.spongycastle.cert.jcajce.JcaX509v3CertificateBuilder; +import org.spongycastle.operator.ContentSigner; +import org.spongycastle.operator.OperatorCreationException; +import org.spongycastle.operator.jcajce.JcaContentSignerBuilder; + +/** + * Generate X509 V3 certificates. CA, RA and SSL can be generated, where + * intermediate certificates are signed from the root certificate to generate + * the chain. + */ +public class CertificateUtil { + private static final Log LOG = LogFactory.getLog(CertificateUtil.class); + + + + + public static X509Certificate signCSR(PublicKey publicKeyToBeSigned, PrivateKey caPrivateKey, X509Certificate caCert) throws Exception{ + try { + X509v3CertificateBuilder certificateBuilder = new JcaX509v3CertificateBuilder(caCert, + BigInteger + .valueOf(new SecureRandom().nextInt(Integer.MAX_VALUE)), + new Date(System.currentTimeMillis()), + new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10)), + new X500Name("CN=abimaran"), + publicKeyToBeSigned); + ContentSigner signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("SC").build(caPrivateKey); + X509Certificate theCert = new JcaX509CertificateConverter().setProvider("SC").getCertificate(certificateBuilder.build(signer)); + return theCert; + + } catch (OperatorCreationException e) { + String message = "Error creating ContentSigner with JcaContentSignerBuilder" + + " with the private key provided."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } catch (CertificateException e) { + String message = "Error building certificate."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/Constants.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/Constants.java new file mode 100644 index 0000000000..78ab76f4fa --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/Constants.java @@ -0,0 +1,117 @@ +/* + * 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.wstep.util; + + +import java.io.File; + +/** + * Constants used throughout the project + */ +public class Constants { + public static class FilePath { + private FilePath() { + throw new AssertionError(); + } + + public static final String BKS_FILE = "emm_truststore.bks"; + public static final String ANDROID_AGENT = "emm-agent-android"; + public static final String WSO2CARBON_JKS = "wso2carbon.jks"; + public static final String CLIENT_TRUST_JKS = "client-truststore.jks"; + + public static final String COMMON_UTIL = ANDROID_AGENT + File.separator + "src" + + File.separator + "org" + File.separator + "wso2" + + File.separator + "emm" + File.separator + "agent" + + File.separator + "utils" + File.separator + + "CommonUtilities.java"; + public static final String WSO2EMM_JKS = "wso2emm.jks"; + public static final String ANDROID_AGENT_RAW = ANDROID_AGENT + File.separator + "res" + + File.separator + "raw" + File.separator; + public static final String ANDROID_AGENT_APK = ANDROID_AGENT + File.separator + "target" + + File.separator + "emm_agent.apk"; + public static final String APK_FOLDER = "Apk"; + public static final String JKS_FOLDER = "jks"; + public static final String BIN_PATH = File.separator + "bin" + File.separator + "mvn"; + public static final String WORKING_DIR = "workingDir"; + public static final String ZIP_PATH = "zipPath"; + } + + public static final String ALGORITHM = "RSA"; + public static final String PROVIDER = "SC"; + public static final String ENCRYPTION = "SHA1withRSA"; + public static final String REGISTRATION_AUTHORITY = "RA"; + public static final String BKS = "BKS"; + public static final String BKS_ALIAS = "cert-alias"; + public static final String JKS = "JKS"; + public static final String SSL = "SSL"; + public static final String ENVIRONMENT_VARIABLE = "MAVEN_HOME"; + public static final String ARCHIVE_TYPE = ".zip"; + public static final String ACTION = "clean"; + public static final String GOAL = "package"; + public static final String SERVER_IP_ANDROID = "String SERVER_IP = \""; + public static final String TRUST_STORE_BKS = "String TRUSTSTORE_PASSWORD = \""; + + public static class CSRDataKeys { + private CSRDataKeys() { + throw new AssertionError(); + } + + public static final String COUNTRY_CA = "countryCA"; + public static final String STATE_CA = "stateCA"; + public static final String LOCALITY_CA = "localityCA"; + public static final String ORGANIZATION_CA = "organizationCA"; + public static final String ORGANIZATION_UNIT_CA = "organizationUCA"; + public static final String DAYS_CA = "daysCA"; + public static final String COMMON_NAME_CA = "commonNameCA"; + public static final String COUNTRY_RA = "countryRA"; + public static final String STATE_RA = "stateRA"; + public static final String LOCALITY_RA = "localityRA"; + public static final String ORGANIZATION_RA = "organizationRA"; + public static final String ORGANIZATION_UNIT_RA = "organizationURA"; + public static final String DAYS_RA = "daysRA"; + public static final String COMMON_NAME_RA = "commonNameRA"; + public static final String COUNTRY_SSL = "countrySSL"; + public static final String STATE_SSL = "stateSSL"; + public static final String LOCALITY_SSL = "localitySSL"; + public static final String ORGANIZATION_SSL = "organizationSSL"; + public static final String ORGANIZATION_UNIT_SSL = "organizationUSSL"; + public static final String DAYS_SSL = "daysSSL"; + public static final String SERVER_IP = "serverIp"; + public static final String PASSWORD = "password"; + public static final String USERSNAME = "usersname"; + public static final String COMPANY = "company"; + + } + + public static class TruststoreKeys { + private TruststoreKeys() { + throw new AssertionError(); + } + + public static final String PASSWORD_PK12_CA = "passwordPK12CA"; + public static final String PASSWORD_PK12_RA = "passwordPK12RA"; + public static final String ALIAS_PK12_CA = "aliasPK12CA"; + public static final String ALIAS_PK12_RA = "aliasPK12RA"; + public static final String PASSWORD_WSO2_EMM_JKS = "passwordWSO2EMMJKS"; + public static final String ALIAS__CLIENT_TRUSTSTORE = "aliasClientTruststore"; + public static final String PASSWORD_CLIENT_TRUSTSTORE = "passwordClientTruststore"; + public static final String ALIAS_WSO2_CARBON = "aliasWSO2Carbon"; + public static final String PASSWORD_WSO2_CARBON = "passwordWSO2Carbon"; + } +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/FileOperator.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/FileOperator.java new file mode 100644 index 0000000000..94c58163a9 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/FileOperator.java @@ -0,0 +1,195 @@ +/* + * 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.wstep.util; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.plexus.util.FileUtils; + +import java.io.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * Common file operations such as read, write PEM files and .zip file creation + * are handled by this class. These methods are added to improve reusability of + * commonly used file operations. + */ +public class FileOperator { + + private static final Log LOG = LogFactory.getLog(FileOperator.class); + + /** + * Copy file from the source path to a destination. + * + * @param source source file path + * @param destination destination file path + * @throws ApkGenerationException + */ + public static void copyFile(String source, String destination) + throws ApkGenerationException { + try { + FileUtils.copyFile(new File(source), new File(destination)); + } catch (IOException e) { + String message = + "Cannot find one of the files, while trying to copy file :" + source + + ", to its destination: " + destination; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } + + /** + * Read a file and returns its content as a {@link String} + * + * @param path of the file to be read. + * @return the content of the file + * @throws ApkGenerationException + */ + public static String readFile(String path) throws ApkGenerationException { + try { + return FileUtils.fileRead(new File(path)); + } catch (IOException e) { + String message = "Error reading file " + path; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } + + /** + * Write content to a physical file + * + * @param path the destination file path + * @param content data to be saved + * @throws ApkGenerationException + */ + public static void fileWrite(String path, String content) throws ApkGenerationException { + try { + FileUtils.fileWrite(path, content); + } catch (IOException e) { + String message = "Error writing to file " + path; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } + + /** + * Creates a zip file from a list of files provided. + * + * @param zipFilePath the path of the final zip file to be created. + * @param files An array of file paths that needs to be added to the zip + * @throws ApkGenerationException + */ + public static void createZip(String zipFilePath, String[] files) + throws ApkGenerationException { + FileOutputStream fileOut; + File fileToCopy; + ZipOutputStream zipOutStream = null; + FileInputStream inputStream = null; + byte[] bytes = new byte[1024]; + int count; + int x = 0; + + try { + fileOut = new FileOutputStream(zipFilePath); + } catch (FileNotFoundException e) { + String message = "Error opening file " + zipFilePath; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + + try { + zipOutStream = new ZipOutputStream(fileOut); + for (x = 0; x < files.length; x++) { + fileToCopy = new File(files[x]); + inputStream = new FileInputStream(files[x]); + zipOutStream.putNextEntry(new ZipEntry(fileToCopy.getName())); + + while ((count = inputStream.read(bytes)) > 0) { + zipOutStream.write(bytes, 0, count); + } + } + } catch (FileNotFoundException e) { + String message = "Cannot open the file ," + files[x] + " to add to zip."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } catch (IOException e) { + String message = "Cannot write file ," + files[x] + " to zip."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + String message = "File error while closing the file, " + files[x]; + LOG.warn(message, e); + } + } + if (zipOutStream != null) { + try { + zipOutStream.close(); + } catch (IOException e) { + String message = "File error while closing the file, " + zipFilePath; + LOG.warn(message, e); + } + } + } + } + + /** + * Get a file input stream when the file name is provided. + * + * @param sourceFile Name of the source file. + * @return the file input stream. + * @throws ApkGenerationException + */ + public static FileInputStream getFileInputStream(String sourceFile) + throws ApkGenerationException { + try { + return new FileInputStream(sourceFile); + } catch (FileNotFoundException e) { + String message = "Cannot open the file ," + sourceFile; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } + + /** + * Generates a new folder if it doesn't exist when the path is given. + * + * @param path the folder path that needs to be created + * @throws ApkGenerationException + */ + public static void makeFolder(String path) throws ApkGenerationException { + try { + File file=new File(path); + if(!file.mkdirs()){ + String message = "Error when creating directory " + path; + LOG.error(message); + throw new ApkGenerationException(message); + } + } catch (SecurityException e) { + String message = "Error when creating directory " + path; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + } +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/KeyStoreGenerator.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/KeyStoreGenerator.java new file mode 100644 index 0000000000..0e88177d51 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/KeyStoreGenerator.java @@ -0,0 +1,94 @@ +/* + * 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.wstep.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +/** + * Creation of key stores and injecting certificates to the key stores is + * handled here. + */ +public class KeyStoreGenerator { + + private static final Log LOG = LogFactory.getLog(KeyStoreGenerator.class); + + /** + * Load/initiate a key store from a provided file. + * + * @param keyStore The destination key store which needs to be loaded. + * @param storePass Password of the key store. + * @param resultFile The source key store file. + * @throws ApkGenerationException + */ + public static void loadToStore(KeyStore keyStore, char[] storePass, String resultFile) + throws ApkGenerationException { + FileInputStream fileInputStream = null; + + try { + if (resultFile != null) { + fileInputStream = FileOperator.getFileInputStream(resultFile); + keyStore.load(fileInputStream, storePass); + } + } catch (NoSuchAlgorithmException e) { + String message = Constants.ALGORITHM + " cryptographic algorithm is requested but" + + " it is not available in the environment."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } catch (CertificateException e) { + String message = "Error working with certificate related to, " + resultFile; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } catch (IOException e) { + String message = "File error while working with file, " + resultFile; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } finally { + try { + if (fileInputStream != null) { + fileInputStream.close(); + } + } catch (IOException e) { + String message = "File error while closing the file, " + resultFile; + LOG.error(message, e); + } + } + } + + public static KeyStore getKeyStore() throws ApkGenerationException { + try { + return KeyStore.getInstance(Constants.JKS); + } catch (KeyStoreException e) { + String message = "KeyStore error while creating new JKS."; + LOG.error(message, e); + throw new ApkGenerationException(message, e); + } + + } + + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PPSRSOApMessageHandler.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PPSRSOApMessageHandler.java new file mode 100644 index 0000000000..62897db308 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PPSRSOApMessageHandler.java @@ -0,0 +1,57 @@ +/* + * 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.wstep.util; + +import javax.xml.namespace.QName; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; +import java.util.HashSet; +import java.util.Set; + +public class PPSRSOApMessageHandler implements SOAPHandler { + + @Override + public Set getHeaders() { + final QName securityHeader = new QName( + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", + "Security", + "wsse"); + + final HashSet headers = new HashSet(); + headers.add(securityHeader); + + System.out.println("CHECKED_HEADER"); + + return headers; + } + + @Override public boolean handleMessage(SOAPMessageContext context) { + return true; + } + + @Override public boolean handleFault(SOAPMessageContext context) { + return true; + } + + @Override public void close(MessageContext context) { + + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PasswordCallbackHandler.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PasswordCallbackHandler.java new file mode 100644 index 0000000000..859ac4676c --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/wstep/util/PasswordCallbackHandler.java @@ -0,0 +1,42 @@ +/* + * 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.wstep.util; + +import org.apache.ws.security.WSPasswordCallback; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; +import java.io.IOException; + +public class PasswordCallbackHandler implements CallbackHandler { + + @Override public void handle(Callback[] callbacks) + throws IOException, UnsupportedCallbackException { + WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; + + System.out.println("CHECKED_BEFORE_IF_SECURITY"); + + if ("asok@wso2.com".equals(pc.getIdentifier())) { + System.out.println("CHECKED_IF_SECURITY" + pc.getIdentifier()); + pc.setPassword("admin"); + return; + } + } +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/IPolicy.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/IPolicy.java new file mode 100644 index 0000000000..923d156557 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/IPolicy.java @@ -0,0 +1,48 @@ +package cdm.api.windows.xcep; + +import cdm.api.windows.xcep.beans.CACollection; +import cdm.api.windows.xcep.beans.OIDCollection; +import cdm.api.windows.xcep.beans.ObjectFactory; +import cdm.api.windows.xcep.beans.Response; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Produces; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.BindingType; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import javax.xml.ws.soap.SOAPBinding; + +/** + * This class was generated by Apache CXF 2.7.3 + * 2015-01-11T12:55:46.432+05:30 + * Generated source version: 2.7.3 + */ +@WebService(targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", name = "IPolicy") +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +@XmlSeeAlso({ ObjectFactory.class }) +public interface IPolicy { + + @RequestWrapper(localName = "GetPolicies", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", className = "com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPolicies") + @WebMethod(operationName = "GetPolicies") + @ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", className = "com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPoliciesResponse") + public void getPolicies( + @WebParam(name = "client", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") + cdm.api.windows.xcep.beans.Client client, + @WebParam(name = "requestFilter", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") + cdm.api.windows.xcep.beans.RequestFilter requestFilter, + @WebParam(mode = WebParam.Mode.OUT, name = "response", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") + javax.xml.ws.Holder response, + @WebParam(mode = WebParam.Mode.OUT, name = "cAs", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") + javax.xml.ws.Holder cAs, + @WebParam(mode = WebParam.Mode.OUT, name = "oIDs", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") + javax.xml.ws.Holder oIDs + ); + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Attributes.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Attributes.java new file mode 100644 index 0000000000..a7e141635b --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Attributes.java @@ -0,0 +1,489 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for Attributes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Attributes">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}commonName"/>
+ *         <element name="policySchema" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="certificateValidity" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CertificateValidity"/>
+ *         <element name="permission" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}EnrollmentPermission"/>
+ *         <element name="privateKeyAttributes" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}PrivateKeyAttributes"/>
+ *         <element name="revision" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}Revision"/>
+ *         <element name="supersededPolicies" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}SupersededPolicies"/>
+ *         <element name="privateKeyFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="subjectNameFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="enrollmentFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="generalFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="hashAlgorithmOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="rARequirements" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}RARequirements"/>
+ *         <element name="keyArchivalAttributes" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}KeyArchivalAttributes"/>
+ *         <element name="extensions" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}ExtensionCollection"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Attributes", propOrder = { + "commonName", + "policySchema", + "certificateValidity", + "permission", + "privateKeyAttributes", + "revision", + "supersededPolicies", + "privateKeyFlags", + "subjectNameFlags", + "enrollmentFlags", + "generalFlags", + "hashAlgorithmOIDReference", + "raRequirements", + "keyArchivalAttributes", + "extensions", + "any" +}) +public class Attributes { + + @XmlElement(required = true) + protected String commonName; + @XmlSchemaType(name = "unsignedInt") + protected long policySchema; + @XmlElement(required = true) + protected CertificateValidity certificateValidity; + @XmlElement(required = true) + protected EnrollmentPermission permission; + @XmlElement(required = true) + protected PrivateKeyAttributes privateKeyAttributes; + @XmlElement(required = true) + protected Revision revision; + @XmlElement(required = true, nillable = true) + protected SupersededPolicies supersededPolicies; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long privateKeyFlags; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long subjectNameFlags; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long enrollmentFlags; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long generalFlags; + @XmlElement(required = true, type = Integer.class, nillable = true) + protected Integer hashAlgorithmOIDReference; + @XmlElement(name = "rARequirements", required = true, nillable = true) + protected RARequirements raRequirements; + @XmlElement(required = true, nillable = true) + protected KeyArchivalAttributes keyArchivalAttributes; + @XmlElement(required = true, nillable = true) + protected ExtensionCollection extensions; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the commonName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCommonName() { + return commonName; + } + + /** + * Sets the value of the commonName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCommonName(String value) { + this.commonName = value; + } + + /** + * Gets the value of the policySchema property. + * + */ + public long getPolicySchema() { + return policySchema; + } + + /** + * Sets the value of the policySchema property. + * + */ + public void setPolicySchema(long value) { + this.policySchema = value; + } + + /** + * Gets the value of the certificateValidity property. + * + * @return + * possible object is + * {@link CertificateValidity } + * + */ + public CertificateValidity getCertificateValidity() { + return certificateValidity; + } + + /** + * Sets the value of the certificateValidity property. + * + * @param value + * allowed object is + * {@link CertificateValidity } + * + */ + public void setCertificateValidity(CertificateValidity value) { + this.certificateValidity = value; + } + + /** + * Gets the value of the permission property. + * + * @return + * possible object is + * {@link EnrollmentPermission } + * + */ + public EnrollmentPermission getPermission() { + return permission; + } + + /** + * Sets the value of the permission property. + * + * @param value + * allowed object is + * {@link EnrollmentPermission } + * + */ + public void setPermission(EnrollmentPermission value) { + this.permission = value; + } + + /** + * Gets the value of the privateKeyAttributes property. + * + * @return + * possible object is + * {@link PrivateKeyAttributes } + * + */ + public PrivateKeyAttributes getPrivateKeyAttributes() { + return privateKeyAttributes; + } + + /** + * Sets the value of the privateKeyAttributes property. + * + * @param value + * allowed object is + * {@link PrivateKeyAttributes } + * + */ + public void setPrivateKeyAttributes(PrivateKeyAttributes value) { + this.privateKeyAttributes = value; + } + + /** + * Gets the value of the revision property. + * + * @return + * possible object is + * {@link Revision } + * + */ + public Revision getRevision() { + return revision; + } + + /** + * Sets the value of the revision property. + * + * @param value + * allowed object is + * {@link Revision } + * + */ + public void setRevision(Revision value) { + this.revision = value; + } + + /** + * Gets the value of the supersededPolicies property. + * + * @return + * possible object is + * {@link SupersededPolicies } + * + */ + public SupersededPolicies getSupersededPolicies() { + return supersededPolicies; + } + + /** + * Sets the value of the supersededPolicies property. + * + * @param value + * allowed object is + * {@link SupersededPolicies } + * + */ + public void setSupersededPolicies(SupersededPolicies value) { + this.supersededPolicies = value; + } + + /** + * Gets the value of the privateKeyFlags property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getPrivateKeyFlags() { + return privateKeyFlags; + } + + /** + * Sets the value of the privateKeyFlags property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setPrivateKeyFlags(Long value) { + this.privateKeyFlags = value; + } + + /** + * Gets the value of the subjectNameFlags property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getSubjectNameFlags() { + return subjectNameFlags; + } + + /** + * Sets the value of the subjectNameFlags property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setSubjectNameFlags(Long value) { + this.subjectNameFlags = value; + } + + /** + * Gets the value of the enrollmentFlags property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getEnrollmentFlags() { + return enrollmentFlags; + } + + /** + * Sets the value of the enrollmentFlags property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setEnrollmentFlags(Long value) { + this.enrollmentFlags = value; + } + + /** + * Gets the value of the generalFlags property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getGeneralFlags() { + return generalFlags; + } + + /** + * Sets the value of the generalFlags property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setGeneralFlags(Long value) { + this.generalFlags = value; + } + + /** + * Gets the value of the hashAlgorithmOIDReference property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getHashAlgorithmOIDReference() { + return hashAlgorithmOIDReference; + } + + /** + * Sets the value of the hashAlgorithmOIDReference property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setHashAlgorithmOIDReference(Integer value) { + this.hashAlgorithmOIDReference = value; + } + + /** + * Gets the value of the raRequirements property. + * + * @return + * possible object is + * {@link RARequirements } + * + */ + public RARequirements getRARequirements() { + return raRequirements; + } + + /** + * Sets the value of the raRequirements property. + * + * @param value + * allowed object is + * {@link RARequirements } + * + */ + public void setRARequirements(RARequirements value) { + this.raRequirements = value; + } + + /** + * Gets the value of the keyArchivalAttributes property. + * + * @return + * possible object is + * {@link KeyArchivalAttributes } + * + */ + public KeyArchivalAttributes getKeyArchivalAttributes() { + return keyArchivalAttributes; + } + + /** + * Sets the value of the keyArchivalAttributes property. + * + * @param value + * allowed object is + * {@link KeyArchivalAttributes } + * + */ + public void setKeyArchivalAttributes(KeyArchivalAttributes value) { + this.keyArchivalAttributes = value; + } + + /** + * Gets the value of the extensions property. + * + * @return + * possible object is + * {@link ExtensionCollection } + * + */ + public ExtensionCollection getExtensions() { + return extensions; + } + + /** + * Sets the value of the extensions property. + * + * @param value + * allowed object is + * {@link ExtensionCollection } + * + */ + public void setExtensions(ExtensionCollection value) { + this.extensions = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CA.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CA.java new file mode 100644 index 0000000000..283b6e4fa7 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CA.java @@ -0,0 +1,165 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for CA complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CA">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="uris" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CAURICollection"/>
+ *         <element name="certificate" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ *         <element name="enrollPermission" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="cAReferenceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CA", propOrder = { + "uris", + "certificate", + "enrollPermission", + "caReferenceID", + "any" +}) +public class CA { + + @XmlElement(required = true) + protected CAURICollection uris; + @XmlElement(required = true) + protected byte[] certificate; + protected boolean enrollPermission; + @XmlElement(name = "cAReferenceID") + protected int caReferenceID; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the uris property. + * + * @return + * possible object is + * {@link CAURICollection } + * + */ + public CAURICollection getUris() { + return uris; + } + + /** + * Sets the value of the uris property. + * + * @param value + * allowed object is + * {@link CAURICollection } + * + */ + public void setUris(CAURICollection value) { + this.uris = value; + } + + /** + * Gets the value of the certificate property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getCertificate() { + return certificate; + } + + /** + * Sets the value of the certificate property. + * + * @param value + * allowed object is + * byte[] + */ + public void setCertificate(byte[] value) { + this.certificate = value; + } + + /** + * Gets the value of the enrollPermission property. + * + */ + public boolean isEnrollPermission() { + return enrollPermission; + } + + /** + * Sets the value of the enrollPermission property. + * + */ + public void setEnrollPermission(boolean value) { + this.enrollPermission = value; + } + + /** + * Gets the value of the caReferenceID property. + * + */ + public int getCAReferenceID() { + return caReferenceID; + } + + /** + * Sets the value of the caReferenceID property. + * + */ + public void setCAReferenceID(int value) { + this.caReferenceID = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CACollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CACollection.java new file mode 100644 index 0000000000..d443cb53d6 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CACollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CACollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CACollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cA" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CA" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CACollection", propOrder = { + "ca" +}) +public class CACollection { + + @XmlElement(name = "cA", required = true) + protected List ca; + + /** + * Gets the value of the ca property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the ca property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getCA().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link CA } + * + * + */ + public List getCA() { + if (ca == null) { + ca = new ArrayList(); + } + return this.ca; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAReferenceCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAReferenceCollection.java new file mode 100644 index 0000000000..20284e2321 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAReferenceCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CAReferenceCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CAReferenceCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cAReference" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CAReferenceCollection", propOrder = { + "caReference" +}) +public class CAReferenceCollection { + + @XmlElement(name = "cAReference", type = Integer.class) + protected List caReference; + + /** + * Gets the value of the caReference property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the caReference property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getCAReference().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Integer } + * + * + */ + public List getCAReference() { + if (caReference == null) { + caReference = new ArrayList(); + } + return this.caReference; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURI.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURI.java new file mode 100644 index 0000000000..fc4a0fd906 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURI.java @@ -0,0 +1,170 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for CAURI complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CAURI">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="clientAuthentication" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="uri" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
+ *         <element name="priority" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="renewalOnly" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CAURI", propOrder = { + "clientAuthentication", + "uri", + "priority", + "renewalOnly", + "any" +}) +public class CAURI { + + @XmlSchemaType(name = "unsignedInt") + protected long clientAuthentication; + @XmlElement(required = true) + @XmlSchemaType(name = "anyURI") + protected String uri; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long priority; + protected boolean renewalOnly; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the clientAuthentication property. + * + */ + public long getClientAuthentication() { + return clientAuthentication; + } + + /** + * Sets the value of the clientAuthentication property. + * + */ + public void setClientAuthentication(long value) { + this.clientAuthentication = value; + } + + /** + * Gets the value of the uri property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUri() { + return uri; + } + + /** + * Sets the value of the uri property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUri(String value) { + this.uri = value; + } + + /** + * Gets the value of the priority property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getPriority() { + return priority; + } + + /** + * Sets the value of the priority property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setPriority(Long value) { + this.priority = value; + } + + /** + * Gets the value of the renewalOnly property. + * + */ + public boolean isRenewalOnly() { + return renewalOnly; + } + + /** + * Sets the value of the renewalOnly property. + * + */ + public void setRenewalOnly(boolean value) { + this.renewalOnly = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURICollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURICollection.java new file mode 100644 index 0000000000..5faeb2bb7e --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CAURICollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CAURICollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CAURICollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cAURI" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CAURI" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CAURICollection", propOrder = { + "cauri" +}) +public class CAURICollection { + + @XmlElement(name = "cAURI", required = true) + protected List cauri; + + /** + * Gets the value of the cauri property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the cauri property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getCAURI().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link CAURI } + * + * + */ + public List getCAURI() { + if (cauri == null) { + cauri = new ArrayList(); + } + return this.cauri; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateEnrollmentPolicy.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateEnrollmentPolicy.java new file mode 100644 index 0000000000..2e40d12f3c --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateEnrollmentPolicy.java @@ -0,0 +1,147 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for CertificateEnrollmentPolicy complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CertificateEnrollmentPolicy">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="policyOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="cAs" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CAReferenceCollection"/>
+ *         <element name="attributes" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}Attributes"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CertificateEnrollmentPolicy", propOrder = { + "policyOIDReference", + "cAs", + "attributes", + "any" +}) +public class CertificateEnrollmentPolicy { + + protected int policyOIDReference; + @XmlElement(required = true, nillable = true) + protected CAReferenceCollection cAs; + @XmlElement(required = true) + protected Attributes attributes; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the policyOIDReference property. + * + */ + public int getPolicyOIDReference() { + return policyOIDReference; + } + + /** + * Sets the value of the policyOIDReference property. + * + */ + public void setPolicyOIDReference(int value) { + this.policyOIDReference = value; + } + + /** + * Gets the value of the cAs property. + * + * @return + * possible object is + * {@link CAReferenceCollection } + * + */ + public CAReferenceCollection getCAs() { + return cAs; + } + + /** + * Sets the value of the cAs property. + * + * @param value + * allowed object is + * {@link CAReferenceCollection } + * + */ + public void setCAs(CAReferenceCollection value) { + this.cAs = value; + } + + /** + * Gets the value of the attributes property. + * + * @return + * possible object is + * {@link Attributes } + * + */ + public Attributes getAttributes() { + return attributes; + } + + /** + * Sets the value of the attributes property. + * + * @param value + * allowed object is + * {@link Attributes } + * + */ + public void setAttributes(Attributes value) { + this.attributes = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateValidity.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateValidity.java new file mode 100644 index 0000000000..341ca05ff1 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CertificateValidity.java @@ -0,0 +1,94 @@ + +package cdm.api.windows.xcep.beans; + +import java.math.BigInteger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CertificateValidity complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CertificateValidity">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="validityPeriodSeconds" type="{http://www.w3.org/2001/XMLSchema}unsignedLong"/>
+ *         <element name="renewalPeriodSeconds" type="{http://www.w3.org/2001/XMLSchema}unsignedLong"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CertificateValidity", propOrder = { + "validityPeriodSeconds", + "renewalPeriodSeconds" +}) +public class CertificateValidity { + + @XmlElement(required = true) + @XmlSchemaType(name = "unsignedLong") + protected BigInteger validityPeriodSeconds; + @XmlElement(required = true) + @XmlSchemaType(name = "unsignedLong") + protected BigInteger renewalPeriodSeconds; + + /** + * Gets the value of the validityPeriodSeconds property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getValidityPeriodSeconds() { + return validityPeriodSeconds; + } + + /** + * Sets the value of the validityPeriodSeconds property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setValidityPeriodSeconds(BigInteger value) { + this.validityPeriodSeconds = value; + } + + /** + * Gets the value of the renewalPeriodSeconds property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getRenewalPeriodSeconds() { + return renewalPeriodSeconds; + } + + /** + * Sets the value of the renewalPeriodSeconds property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setRenewalPeriodSeconds(BigInteger value) { + this.renewalPeriodSeconds = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Client.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Client.java new file mode 100644 index 0000000000..a1d7fe1e4a --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Client.java @@ -0,0 +1,135 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.datatype.XMLGregorianCalendar; +import org.w3c.dom.Element; + + +/** + *

Java class for Client complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Client">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="lastUpdate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
+ *         <element name="preferredLanguage" type="{http://www.w3.org/2001/XMLSchema}language"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Client", propOrder = { + "lastUpdate", + "preferredLanguage", + "any" +}) +public class Client { + + @XmlElement(required = true, nillable = true) + @XmlSchemaType(name = "dateTime") + protected XMLGregorianCalendar lastUpdate; + @XmlElement(required = true, nillable = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String preferredLanguage; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the lastUpdate property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getLastUpdate() { + return lastUpdate; + } + + /** + * Sets the value of the lastUpdate property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setLastUpdate(XMLGregorianCalendar value) { + this.lastUpdate = value; + } + + /** + * Gets the value of the preferredLanguage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPreferredLanguage() { + return preferredLanguage; + } + + /** + * Sets the value of the preferredLanguage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPreferredLanguage(String value) { + this.preferredLanguage = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CryptoProviders.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CryptoProviders.java new file mode 100644 index 0000000000..3a1a935822 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/CryptoProviders.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CryptoProviders complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CryptoProviders">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CryptoProviders", propOrder = { + "provider" +}) +public class CryptoProviders { + + @XmlElement(required = true) + protected List provider; + + /** + * Gets the value of the provider property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the provider property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getProvider().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getProvider() { + if (provider == null) { + provider = new ArrayList(); + } + return this.provider; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/EnrollmentPermission.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/EnrollmentPermission.java new file mode 100644 index 0000000000..5abcb7406c --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/EnrollmentPermission.java @@ -0,0 +1,71 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for EnrollmentPermission complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="EnrollmentPermission">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="enroll" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="autoEnroll" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "EnrollmentPermission", propOrder = { + "enroll", + "autoEnroll" +}) +public class EnrollmentPermission { + + protected boolean enroll; + protected boolean autoEnroll; + + /** + * Gets the value of the enroll property. + * + */ + public boolean isEnroll() { + return enroll; + } + + /** + * Sets the value of the enroll property. + * + */ + public void setEnroll(boolean value) { + this.enroll = value; + } + + /** + * Gets the value of the autoEnroll property. + * + */ + public boolean isAutoEnroll() { + return autoEnroll; + } + + /** + * Sets the value of the autoEnroll property. + * + */ + public void setAutoEnroll(boolean value) { + this.autoEnroll = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Extension.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Extension.java new file mode 100644 index 0000000000..811b30786d --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Extension.java @@ -0,0 +1,99 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for Extension complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Extension">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="oIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="critical" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Extension", propOrder = { + "oidReference", + "critical", + "value" +}) +public class Extension { + + @XmlElement(name = "oIDReference") + protected int oidReference; + protected boolean critical; + @XmlElement(required = true, nillable = true) + protected byte[] value; + + /** + * Gets the value of the oidReference property. + * + */ + public int getOIDReference() { + return oidReference; + } + + /** + * Sets the value of the oidReference property. + * + */ + public void setOIDReference(int value) { + this.oidReference = value; + } + + /** + * Gets the value of the critical property. + * + */ + public boolean isCritical() { + return critical; + } + + /** + * Sets the value of the critical property. + * + */ + public void setCritical(boolean value) { + this.critical = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * byte[] + */ + public byte[] getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * byte[] + */ + public void setValue(byte[] value) { + this.value = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ExtensionCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ExtensionCollection.java new file mode 100644 index 0000000000..6bd2e9d1be --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ExtensionCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ExtensionCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ExtensionCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="extension" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}Extension" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ExtensionCollection", propOrder = { + "extension" +}) +public class ExtensionCollection { + + @XmlElement(required = true) + protected List extension; + + /** + * Gets the value of the extension property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the extension property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getExtension().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Extension } + * + * + */ + public List getExtension() { + if (extension == null) { + extension = new ArrayList(); + } + return this.extension; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/FilterOIDCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/FilterOIDCollection.java new file mode 100644 index 0000000000..c470f1bf9a --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/FilterOIDCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for FilterOIDCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="FilterOIDCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="oid" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "FilterOIDCollection", propOrder = { + "oid" +}) +public class FilterOIDCollection { + + @XmlElement(required = true) + protected List oid; + + /** + * Gets the value of the oid property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the oid property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getOid().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getOid() { + if (oid == null) { + oid = new ArrayList(); + } + return this.oid; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPolicies.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPolicies.java new file mode 100644 index 0000000000..5051985129 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPolicies.java @@ -0,0 +1,92 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="client" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}Client"/>
+ *         <element name="requestFilter" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}RequestFilter"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "client", + "requestFilter" +}) +@XmlRootElement(name = "GetPolicies") +public class GetPolicies { + + @XmlElement(required = true) + protected Client client; + @XmlElement(required = true, nillable = true) + protected RequestFilter requestFilter; + + /** + * Gets the value of the client property. + * + * @return + * possible object is + * {@link Client } + * + */ + public Client getClient() { + return client; + } + + /** + * Sets the value of the client property. + * + * @param value + * allowed object is + * {@link Client } + * + */ + public void setClient(Client value) { + this.client = value; + } + + /** + * Gets the value of the requestFilter property. + * + * @return + * possible object is + * {@link RequestFilter } + * + */ + public RequestFilter getRequestFilter() { + return requestFilter; + } + + /** + * Sets the value of the requestFilter property. + * + * @param value + * allowed object is + * {@link RequestFilter } + * + */ + public void setRequestFilter(RequestFilter value) { + this.requestFilter = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPoliciesResponse.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPoliciesResponse.java new file mode 100644 index 0000000000..e2ccacc093 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/GetPoliciesResponse.java @@ -0,0 +1,120 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="response" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}Response"/>
+ *         <element name="cAs" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CACollection"/>
+ *         <element name="oIDs" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}OIDCollection"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "response", + "cAs", + "oiDs" +}) +@XmlRootElement(name = "GetPoliciesResponse") +public class GetPoliciesResponse { + + @XmlElement(required = true, nillable = true) + protected Response response; + @XmlElement(required = true, nillable = true) + protected CACollection cAs; + @XmlElement(name = "oIDs", required = true, nillable = true) + protected OIDCollection oiDs; + + /** + * Gets the value of the response property. + * + * @return + * possible object is + * {@link Response } + * + */ + public Response getResponse() { + return response; + } + + /** + * Sets the value of the response property. + * + * @param value + * allowed object is + * {@link Response } + * + */ + public void setResponse(Response value) { + this.response = value; + } + + /** + * Gets the value of the cAs property. + * + * @return + * possible object is + * {@link CACollection } + * + */ + public CACollection getCAs() { + return cAs; + } + + /** + * Sets the value of the cAs property. + * + * @param value + * allowed object is + * {@link CACollection } + * + */ + public void setCAs(CACollection value) { + this.cAs = value; + } + + /** + * Gets the value of the oiDs property. + * + * @return + * possible object is + * {@link OIDCollection } + * + */ + public OIDCollection getOIDs() { + return oiDs; + } + + /** + * Sets the value of the oiDs property. + * + * @param value + * allowed object is + * {@link OIDCollection } + * + */ + public void setOIDs(OIDCollection value) { + this.oiDs = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/KeyArchivalAttributes.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/KeyArchivalAttributes.java new file mode 100644 index 0000000000..817d02373d --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/KeyArchivalAttributes.java @@ -0,0 +1,73 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for KeyArchivalAttributes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="KeyArchivalAttributes">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="symmetricAlgorithmOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="symmetricAlgorithmKeyLength" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "KeyArchivalAttributes", propOrder = { + "symmetricAlgorithmOIDReference", + "symmetricAlgorithmKeyLength" +}) +public class KeyArchivalAttributes { + + protected int symmetricAlgorithmOIDReference; + @XmlSchemaType(name = "unsignedInt") + protected long symmetricAlgorithmKeyLength; + + /** + * Gets the value of the symmetricAlgorithmOIDReference property. + * + */ + public int getSymmetricAlgorithmOIDReference() { + return symmetricAlgorithmOIDReference; + } + + /** + * Sets the value of the symmetricAlgorithmOIDReference property. + * + */ + public void setSymmetricAlgorithmOIDReference(int value) { + this.symmetricAlgorithmOIDReference = value; + } + + /** + * Gets the value of the symmetricAlgorithmKeyLength property. + * + */ + public long getSymmetricAlgorithmKeyLength() { + return symmetricAlgorithmKeyLength; + } + + /** + * Sets the value of the symmetricAlgorithmKeyLength property. + * + */ + public void setSymmetricAlgorithmKeyLength(long value) { + this.symmetricAlgorithmKeyLength = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OID.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OID.java new file mode 100644 index 0000000000..420d2dc173 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OID.java @@ -0,0 +1,169 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for OID complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OID">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="group" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="oIDReferenceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="defaultName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OID", propOrder = { + "value", + "group", + "oidReferenceID", + "defaultName", + "any" +}) +public class OID { + + @XmlElement(required = true) + protected String value; + @XmlSchemaType(name = "unsignedInt") + protected long group; + @XmlElement(name = "oIDReferenceID") + protected int oidReferenceID; + @XmlElement(required = true, nillable = true) + protected String defaultName; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the group property. + * + */ + public long getGroup() { + return group; + } + + /** + * Sets the value of the group property. + * + */ + public void setGroup(long value) { + this.group = value; + } + + /** + * Gets the value of the oidReferenceID property. + * + */ + public int getOIDReferenceID() { + return oidReferenceID; + } + + /** + * Sets the value of the oidReferenceID property. + * + */ + public void setOIDReferenceID(int value) { + this.oidReferenceID = value; + } + + /** + * Gets the value of the defaultName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDefaultName() { + return defaultName; + } + + /** + * Sets the value of the defaultName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDefaultName(String value) { + this.defaultName = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDCollection.java new file mode 100644 index 0000000000..d78178f2e4 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for OIDCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OIDCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="oID" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}OID" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OIDCollection", propOrder = { + "oid" +}) +public class OIDCollection { + + @XmlElement(name = "oID", required = true) + protected List oid; + + /** + * Gets the value of the oid property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the oid property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getOID().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link OID } + * + * + */ + public List getOID() { + if (oid == null) { + oid = new ArrayList(); + } + return this.oid; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDReferenceCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDReferenceCollection.java new file mode 100644 index 0000000000..bcb94967ba --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/OIDReferenceCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for OIDReferenceCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OIDReferenceCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="oIDReference" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OIDReferenceCollection", propOrder = { + "oidReference" +}) +public class OIDReferenceCollection { + + @XmlElement(name = "oIDReference", type = Integer.class) + protected List oidReference; + + /** + * Gets the value of the oidReference property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the oidReference property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getOIDReference().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Integer } + * + * + */ + public List getOIDReference() { + if (oidReference == null) { + oidReference = new ArrayList(); + } + return this.oidReference; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ObjectFactory.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ObjectFactory.java new file mode 100644 index 0000000000..b411bedd57 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/ObjectFactory.java @@ -0,0 +1,261 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _CommonName_QNAME = new QName("http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", "commonName"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link GetPolicies } + * + */ + public GetPolicies createGetPolicies() { + return new GetPolicies(); + } + + /** + * Create an instance of {@link Client } + * + */ + public Client createClient() { + return new Client(); + } + + /** + * Create an instance of {@link RequestFilter } + * + */ + public RequestFilter createRequestFilter() { + return new RequestFilter(); + } + + /** + * Create an instance of {@link GetPoliciesResponse } + * + */ + public GetPoliciesResponse createGetPoliciesResponse() { + return new GetPoliciesResponse(); + } + + /** + * Create an instance of {@link Response } + * + */ + public Response createResponse() { + return new Response(); + } + + /** + * Create an instance of {@link CACollection } + * + */ + public CACollection createCACollection() { + return new CACollection(); + } + + /** + * Create an instance of {@link OIDCollection } + * + */ + public OIDCollection createOIDCollection() { + return new OIDCollection(); + } + + /** + * Create an instance of {@link SupersededPolicies } + * + */ + public SupersededPolicies createSupersededPolicies() { + return new SupersededPolicies(); + } + + /** + * Create an instance of {@link OID } + * + */ + public OID createOID() { + return new OID(); + } + + /** + * Create an instance of {@link ExtensionCollection } + * + */ + public ExtensionCollection createExtensionCollection() { + return new ExtensionCollection(); + } + + /** + * Create an instance of {@link Attributes } + * + */ + public Attributes createAttributes() { + return new Attributes(); + } + + /** + * Create an instance of {@link EnrollmentPermission } + * + */ + public EnrollmentPermission createEnrollmentPermission() { + return new EnrollmentPermission(); + } + + /** + * Create an instance of {@link CAReferenceCollection } + * + */ + public CAReferenceCollection createCAReferenceCollection() { + return new CAReferenceCollection(); + } + + /** + * Create an instance of {@link CertificateValidity } + * + */ + public CertificateValidity createCertificateValidity() { + return new CertificateValidity(); + } + + /** + * Create an instance of {@link CAURICollection } + * + */ + public CAURICollection createCAURICollection() { + return new CAURICollection(); + } + + /** + * Create an instance of {@link PolicyCollection } + * + */ + public PolicyCollection createPolicyCollection() { + return new PolicyCollection(); + } + + /** + * Create an instance of {@link Revision } + * + */ + public Revision createRevision() { + return new Revision(); + } + + /** + * Create an instance of {@link OIDReferenceCollection } + * + */ + public OIDReferenceCollection createOIDReferenceCollection() { + return new OIDReferenceCollection(); + } + + /** + * Create an instance of {@link CA } + * + */ + public CA createCA() { + return new CA(); + } + + /** + * Create an instance of {@link CertificateEnrollmentPolicy } + * + */ + public CertificateEnrollmentPolicy createCertificateEnrollmentPolicy() { + return new CertificateEnrollmentPolicy(); + } + + /** + * Create an instance of {@link CryptoProviders } + * + */ + public CryptoProviders createCryptoProviders() { + return new CryptoProviders(); + } + + /** + * Create an instance of {@link Extension } + * + */ + public Extension createExtension() { + return new Extension(); + } + + /** + * Create an instance of {@link FilterOIDCollection } + * + */ + public FilterOIDCollection createFilterOIDCollection() { + return new FilterOIDCollection(); + } + + /** + * Create an instance of {@link CAURI } + * + */ + public CAURI createCAURI() { + return new CAURI(); + } + + /** + * Create an instance of {@link RARequirements } + * + */ + public RARequirements createRARequirements() { + return new RARequirements(); + } + + /** + * Create an instance of {@link PrivateKeyAttributes } + * + */ + public PrivateKeyAttributes createPrivateKeyAttributes() { + return new PrivateKeyAttributes(); + } + + /** + * Create an instance of {@link KeyArchivalAttributes } + * + */ + public KeyArchivalAttributes createKeyArchivalAttributes() { + return new KeyArchivalAttributes(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", name = "commonName") + public JAXBElement createCommonName(String value) { + return new JAXBElement(_CommonName_QNAME, String.class, null, value); + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PolicyCollection.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PolicyCollection.java new file mode 100644 index 0000000000..5ec59f1880 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PolicyCollection.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PolicyCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PolicyCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="policy" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CertificateEnrollmentPolicy" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PolicyCollection", propOrder = { + "policy" +}) +public class PolicyCollection { + + @XmlElement(required = true) + protected List policy; + + /** + * Gets the value of the policy property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the policy property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getPolicy().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link CertificateEnrollmentPolicy } + * + * + */ + public List getPolicy() { + if (policy == null) { + policy = new ArrayList(); + } + return this.policy; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PrivateKeyAttributes.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PrivateKeyAttributes.java new file mode 100644 index 0000000000..f0892bc4b7 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/PrivateKeyAttributes.java @@ -0,0 +1,197 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PrivateKeyAttributes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PrivateKeyAttributes">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="minimalKeyLength" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="keySpec" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="keyUsageProperty" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="permissions" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="algorithmOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="cryptoProviders" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}CryptoProviders"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PrivateKeyAttributes", propOrder = { + "minimalKeyLength", + "keySpec", + "keyUsageProperty", + "permissions", + "algorithmOIDReference", + "cryptoProviders" +}) +public class PrivateKeyAttributes { + + @XmlSchemaType(name = "unsignedInt") + protected long minimalKeyLength; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long keySpec; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long keyUsageProperty; + @XmlElement(required = true, nillable = true) + protected String permissions; + @XmlElement(required = true, type = Integer.class, nillable = true) + protected Integer algorithmOIDReference; + @XmlElement(required = true, nillable = true) + protected CryptoProviders cryptoProviders; + + /** + * Gets the value of the minimalKeyLength property. + * + */ + public long getMinimalKeyLength() { + return minimalKeyLength; + } + + /** + * Sets the value of the minimalKeyLength property. + * + */ + public void setMinimalKeyLength(long value) { + this.minimalKeyLength = value; + } + + /** + * Gets the value of the keySpec property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getKeySpec() { + return keySpec; + } + + /** + * Sets the value of the keySpec property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setKeySpec(Long value) { + this.keySpec = value; + } + + /** + * Gets the value of the keyUsageProperty property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getKeyUsageProperty() { + return keyUsageProperty; + } + + /** + * Sets the value of the keyUsageProperty property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setKeyUsageProperty(Long value) { + this.keyUsageProperty = value; + } + + /** + * Gets the value of the permissions property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPermissions() { + return permissions; + } + + /** + * Sets the value of the permissions property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPermissions(String value) { + this.permissions = value; + } + + /** + * Gets the value of the algorithmOIDReference property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getAlgorithmOIDReference() { + return algorithmOIDReference; + } + + /** + * Sets the value of the algorithmOIDReference property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setAlgorithmOIDReference(Integer value) { + this.algorithmOIDReference = value; + } + + /** + * Gets the value of the cryptoProviders property. + * + * @return + * possible object is + * {@link CryptoProviders } + * + */ + public CryptoProviders getCryptoProviders() { + return cryptoProviders; + } + + /** + * Sets the value of the cryptoProviders property. + * + * @param value + * allowed object is + * {@link CryptoProviders } + * + */ + public void setCryptoProviders(CryptoProviders value) { + this.cryptoProviders = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RARequirements.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RARequirements.java new file mode 100644 index 0000000000..0f31a63a32 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RARequirements.java @@ -0,0 +1,112 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for RARequirements complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RARequirements">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="rASignatures" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="rAEKUs" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}OIDReferenceCollection"/>
+ *         <element name="rAPolicies" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}OIDReferenceCollection"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RARequirements", propOrder = { + "raSignatures", + "raekUs", + "raPolicies" +}) +public class RARequirements { + + @XmlElement(name = "rASignatures") + @XmlSchemaType(name = "unsignedInt") + protected long raSignatures; + @XmlElement(name = "rAEKUs", required = true, nillable = true) + protected OIDReferenceCollection raekUs; + @XmlElement(name = "rAPolicies", required = true, nillable = true) + protected OIDReferenceCollection raPolicies; + + /** + * Gets the value of the raSignatures property. + * + */ + public long getRASignatures() { + return raSignatures; + } + + /** + * Sets the value of the raSignatures property. + * + */ + public void setRASignatures(long value) { + this.raSignatures = value; + } + + /** + * Gets the value of the raekUs property. + * + * @return + * possible object is + * {@link OIDReferenceCollection } + * + */ + public OIDReferenceCollection getRAEKUs() { + return raekUs; + } + + /** + * Sets the value of the raekUs property. + * + * @param value + * allowed object is + * {@link OIDReferenceCollection } + * + */ + public void setRAEKUs(OIDReferenceCollection value) { + this.raekUs = value; + } + + /** + * Gets the value of the raPolicies property. + * + * @return + * possible object is + * {@link OIDReferenceCollection } + * + */ + public OIDReferenceCollection getRAPolicies() { + return raPolicies; + } + + /** + * Sets the value of the raPolicies property. + * + * @param value + * allowed object is + * {@link OIDReferenceCollection } + * + */ + public void setRAPolicies(OIDReferenceCollection value) { + this.raPolicies = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RequestFilter.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RequestFilter.java new file mode 100644 index 0000000000..4037b95b65 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/RequestFilter.java @@ -0,0 +1,100 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for RequestFilter complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="RequestFilter">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="policyOIDs" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}FilterOIDCollection"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "RequestFilter", propOrder = { + "policyOIDs", + "any" +}) +public class RequestFilter { + + @XmlElement(required = true, nillable = true) + protected FilterOIDCollection policyOIDs; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the policyOIDs property. + * + * @return + * possible object is + * {@link FilterOIDCollection } + * + */ + public FilterOIDCollection getPolicyOIDs() { + return policyOIDs; + } + + /** + * Sets the value of the policyOIDs property. + * + * @param value + * allowed object is + * {@link FilterOIDCollection } + * + */ + public void setPolicyOIDs(FilterOIDCollection value) { + this.policyOIDs = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Response.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Response.java new file mode 100644 index 0000000000..0fadb8dc83 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Response.java @@ -0,0 +1,214 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + *

Java class for Response complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Response">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="policyID" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="policyFriendlyName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="nextUpdateHours" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="policiesNotChanged" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="policies" type="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}PolicyCollection"/>
+ *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Response", propOrder = { + "policyID", + "policyFriendlyName", + "nextUpdateHours", + "policiesNotChanged", + "policies", + "any" +}) +public class Response { + + @XmlElement(required = true) + protected String policyID; + @XmlElement(required = true, nillable = true) + protected String policyFriendlyName; + @XmlElement(required = true, type = Long.class, nillable = true) + @XmlSchemaType(name = "unsignedInt") + protected Long nextUpdateHours; + @XmlElement(required = true, type = Boolean.class, nillable = true) + protected Boolean policiesNotChanged; + @XmlElement(required = true, nillable = true) + protected PolicyCollection policies; + @XmlAnyElement(lax = true) + protected List any; + + /** + * Gets the value of the policyID property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPolicyID() { + return policyID; + } + + /** + * Sets the value of the policyID property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPolicyID(String value) { + this.policyID = value; + } + + /** + * Gets the value of the policyFriendlyName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPolicyFriendlyName() { + return policyFriendlyName; + } + + /** + * Sets the value of the policyFriendlyName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPolicyFriendlyName(String value) { + this.policyFriendlyName = value; + } + + /** + * Gets the value of the nextUpdateHours property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getNextUpdateHours() { + return nextUpdateHours; + } + + /** + * Sets the value of the nextUpdateHours property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setNextUpdateHours(Long value) { + this.nextUpdateHours = value; + } + + /** + * Gets the value of the policiesNotChanged property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isPoliciesNotChanged() { + return policiesNotChanged; + } + + /** + * Sets the value of the policiesNotChanged property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setPoliciesNotChanged(Boolean value) { + this.policiesNotChanged = value; + } + + /** + * Gets the value of the policies property. + * + * @return + * possible object is + * {@link PolicyCollection } + * + */ + public PolicyCollection getPolicies() { + return policies; + } + + /** + * Sets the value of the policies property. + * + * @param value + * allowed object is + * {@link PolicyCollection } + * + */ + public void setPolicies(PolicyCollection value) { + this.policies = value; + } + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAny().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList(); + } + return this.any; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Revision.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Revision.java new file mode 100644 index 0000000000..decbceff53 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/Revision.java @@ -0,0 +1,74 @@ + +package cdm.api.windows.xcep.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for Revision complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Revision">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="majorRevision" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *         <element name="minorRevision" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Revision", propOrder = { + "majorRevision", + "minorRevision" +}) +public class Revision { + + @XmlSchemaType(name = "unsignedInt") + protected long majorRevision; + @XmlSchemaType(name = "unsignedInt") + protected long minorRevision; + + /** + * Gets the value of the majorRevision property. + * + */ + public long getMajorRevision() { + return majorRevision; + } + + /** + * Sets the value of the majorRevision property. + * + */ + public void setMajorRevision(long value) { + this.majorRevision = value; + } + + /** + * Gets the value of the minorRevision property. + * + */ + public long getMinorRevision() { + return minorRevision; + } + + /** + * Sets the value of the minorRevision property. + * + */ + public void setMinorRevision(long value) { + this.minorRevision = value; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/SupersededPolicies.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/SupersededPolicies.java new file mode 100644 index 0000000000..cc031cc4dc --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/SupersededPolicies.java @@ -0,0 +1,69 @@ + +package cdm.api.windows.xcep.beans; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for SupersededPolicies complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SupersededPolicies">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy}commonName" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SupersededPolicies", propOrder = { + "commonName" +}) +public class SupersededPolicies { + + @XmlElement(required = true) + protected List commonName; + + /** + * Gets the value of the commonName property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the commonName property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getCommonName().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getCommonName() { + if (commonName == null) { + commonName = new ArrayList(); + } + return this.commonName; + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/package-info.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/package-info.java new file mode 100644 index 0000000000..d43da1ec66 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/beans/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package cdm.api.windows.xcep.beans; diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/impl/xcepimpl.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/impl/xcepimpl.java new file mode 100644 index 0000000000..03caea7ea6 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/impl/xcepimpl.java @@ -0,0 +1,79 @@ +/* + * 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.xcep.impl; + +import cdm.api.windows.xcep.IPolicy; +import cdm.api.windows.xcep.beans.*; +import javax.jws.WebService; +import javax.xml.ws.BindingType; +import javax.xml.ws.Holder; +import javax.xml.ws.soap.Addressing; +import javax.xml.ws.soap.SOAPBinding; + +@WebService(endpointInterface = "cdm.api.windows.xcep.IPolicy", targetNamespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy") +@Addressing(enabled = true, required = true) +@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +public class xcepimpl implements IPolicy { + + @Override + public void getPolicies(Client client, RequestFilter requestFilter, + Holder response, Holder cAs, + Holder oIDs) { + + System.out.println("CHECKED_SERVICE"); + + + Response rs = new Response(); + OIDCollection oidc = new OIDCollection(); + CACollection cac = new CACollection(); + + PolicyCollection pc = new PolicyCollection(); + + CertificateEnrollmentPolicy cnp = new CertificateEnrollmentPolicy(); + Attributes at = new Attributes(); + PrivateKeyAttributes pkat = new PrivateKeyAttributes(); + + pkat.setMinimalKeyLength(2048); + + at.setPolicySchema(3); + at.setPrivateKeyAttributes(pkat); + at.setHashAlgorithmOIDReference(0); + + cnp.setPolicyOIDReference(0); + cnp.setAttributes(at); + + pc.getPolicy().add(cnp); + + rs.setPolicies(pc); + + response.value = rs; + + OID oid = new OID(); + oid.setValue("1.3.14.3.2.29"); + oid.setGroup(1); + oid.setOIDReferenceID(0); + oid.setDefaultName("szOID_OIWSEC_sha1RSASign"); + + oidc.getOID().add(oid); + cAs.value = cac; + oIDs.value = oidc; + + } + +} diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/PPSRSOApMessageHandler.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/PPSRSOApMessageHandler.java new file mode 100644 index 0000000000..4c0f8adef4 --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/PPSRSOApMessageHandler.java @@ -0,0 +1,58 @@ +/* + * 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.xcep.util; + + +import java.util.HashSet; +import java.util.Set; +import javax.xml.namespace.QName; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +public class PPSRSOApMessageHandler implements SOAPHandler { + + @Override + public Set getHeaders() { + final QName securityHeader = new QName( + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", + "Security", + "wsse"); + + final HashSet headers = new HashSet(); + headers.add(securityHeader); + + System.out.println("CHECKED_HEADER"); + + return headers; + } + + @Override public boolean handleMessage(SOAPMessageContext context) { + return true; + } + + @Override public boolean handleFault(SOAPMessageContext context) { + return true; + } + + @Override public void close(MessageContext context) { + + } + +} \ No newline at end of file diff --git a/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/ServerPasswordCallback.java b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/ServerPasswordCallback.java new file mode 100644 index 0000000000..0fd039a07c --- /dev/null +++ b/product/modules/mobileservices/agents/windows/jax-rs/src/main/java/cdm/api/windows/xcep/util/ServerPasswordCallback.java @@ -0,0 +1,40 @@ +/* + * 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.xcep.util; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; +import java.io.IOException; +import org.apache.wss4j.common.ext.WSPasswordCallback; + +public class ServerPasswordCallback implements CallbackHandler { + + @Override public void handle(Callback[] callbacks) + throws IOException, UnsupportedCallbackException { + WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; + + System.out.println("CHECKED_BEFORE_IF_SECURITY"); + + if ("asok@wso2.com".equals(pc.getIdentifier())) { + System.out.println("CHECKED_IF_SECURITY"); + pc.setPassword("admin"); + } + } +} From 2947e6fd21c4d13ba03306f349adb73c45f02021 Mon Sep 17 00:00:00 2001 From: asok Date: Thu, 22 Jan 2015 19:12:40 +0530 Subject: [PATCH 3/3] commiting windows plugin --- .../agents/windows/jax-rs/pom.xml | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/product/modules/mobileservices/agents/windows/jax-rs/pom.xml b/product/modules/mobileservices/agents/windows/jax-rs/pom.xml index 8f9ab89a7a..326e4885c1 100644 --- a/product/modules/mobileservices/agents/windows/jax-rs/pom.xml +++ b/product/modules/mobileservices/agents/windows/jax-rs/pom.xml @@ -29,9 +29,9 @@ 4.0.0 org.wso2.carbon - cdm-android-api - JAX-RS Android API - JAX-RS Android API + cdm-windows-api + JAX-RS Windows API + JAX-RS Windows API war @@ -159,6 +159,26 @@ wss4j-ws-security-common 2.0.0 + + org.bouncycastle + bcpkix-jdk15on + 1.49 + + + org.bouncycastle + bcprov-jdk15on + 1.49 + + + org.codehaus.plexus + plexus-utils + 3.0.21 + + + com.madgag.spongycastle + pkix + 1.51.0.0 + org.apache.cxf cxf-rt-ws-security