From ebe0aa2663d476bbfcfa6fa1615b62729d17f895 Mon Sep 17 00:00:00 2001 From: asok Date: Wed, 21 Jan 2015 16:34:03 +0530 Subject: [PATCH] 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"); + } + } +}