forked from community/device-mgt-plugins
Merge with upstream master See merge request entgra/carbon-device-mgt-plugins!62revert-dabc3590
commit
7062d9add5
@ -1,407 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (c) 2016, 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.a
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
|
||||||
~ software distributed under the License is distributed on an
|
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
~ KIND, either express or implied. See the License for the
|
|
||||||
~ specific language governing permissions and limitations
|
|
||||||
~ under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>windows-plugin</artifactId>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<version>4.2.7-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.mobile.windows.api</artifactId>
|
|
||||||
<name>WSO2 Carbon - Windows JAX-RS API</name>
|
|
||||||
<description>Windows JAX-RS API</description>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
<version>2.3.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<version>2.2</version>
|
|
||||||
<configuration>
|
|
||||||
<!--<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>-->
|
|
||||||
<warName>api#device-mgt#windows#v1.0</warName>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.jacoco</groupId>
|
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>jacoco-initialize</id>
|
|
||||||
<goals>
|
|
||||||
<goal>prepare-agent</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>jacoco-site</id>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>report</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
|
|
||||||
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>deploy</id>
|
|
||||||
<build>
|
|
||||||
<defaultGoal>compile</defaultGoal>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<tasks>
|
|
||||||
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
|
|
||||||
<fileset dir="${basedir}/target">
|
|
||||||
<include name="api#device-mgt#windows#v1.0.war" />
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</tasks>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
|
|
||||||
<profile>
|
|
||||||
<id>client</id>
|
|
||||||
<build>
|
|
||||||
<defaultGoal>test</defaultGoal>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
|
||||||
<version>1.2.1</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>java</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!--project dependancies-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-transports-http</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-bindings-soap</artifactId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-bindings-http</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.ws.security</groupId>
|
|
||||||
<artifactId>wss4j</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-rs-extension-providers</artifactId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-ws-security</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.wss4j</groupId>
|
|
||||||
<artifactId>wss4j-ws-security-common</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
|
|
||||||
<artifactId>axiom</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!--dependency>
|
|
||||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
|
||||||
<artifactId>axiom-impl</artifactId>
|
|
||||||
</dependency-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!--dependency>
|
|
||||||
<groupId>org.springframework.ws</groupId>
|
|
||||||
<artifactId>spring-ws-security</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
</dependency-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.ws</groupId>
|
|
||||||
<artifactId>jaxws-rt</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.messaging.saaj</groupId>
|
|
||||||
<artifactId>saaj-impl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.orbit.org.bouncycastle</groupId>
|
|
||||||
<artifactId>bcpkix-jdk15on</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.orbit.org.bouncycastle</groupId>
|
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
|
||||||
<artifactId>plexus-utils</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.madgag.spongycastle</groupId>
|
|
||||||
<artifactId>pkix</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.madgag.spongycastle</groupId>
|
|
||||||
<artifactId>prov</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.madgag.spongycastle</groupId>
|
|
||||||
<artifactId>core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.ws.rs</groupId>
|
|
||||||
<artifactId>jsr311-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.testng</groupId>
|
|
||||||
<artifactId>testng</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--CDM dependancies-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.mobile.windows</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon.identity</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.identity.base</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.cache</groupId>
|
|
||||||
<artifactId>cache-api</artifactId>
|
|
||||||
<version>0.5</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.tomcat</groupId>
|
|
||||||
<artifactId>tomcat-servlet-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jettison.wso2</groupId>
|
|
||||||
<artifactId>jettison</artifactId>
|
|
||||||
<version>1.1.wso2v1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.json.wso2</groupId>
|
|
||||||
<artifactId>json</artifactId>
|
|
||||||
<version>2.0.0.wso2v1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger</groupId>
|
|
||||||
<artifactId>swagger-annotations</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger</groupId>
|
|
||||||
<artifactId>swagger-core</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger</groupId>
|
|
||||||
<artifactId>swagger-jaxrs</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,277 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.bean;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.apache.juli.logging.Log;
|
|
||||||
import org.apache.juli.logging.LogFactory;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.ProfileConfigurationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationCode;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlGenerator;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ApiModel(value = "EnterpriseApplication", description = "Information related to Enterprise Application.")
|
|
||||||
public class EnterpriseApplication extends WindowsOperation {
|
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(EnterpriseApplication.class);
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "packageURL", value = "Package URL.")
|
|
||||||
private HostedAppxApplication hostedAppxApplication;
|
|
||||||
@ApiModelProperty(name = "packageFamilyName", value = "Package family name.")
|
|
||||||
private HostedMSIApplication hostedMSIApplication;
|
|
||||||
|
|
||||||
public HostedAppxApplication getHostedAppxApplication() {
|
|
||||||
return hostedAppxApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostedAppxApplication(HostedAppxApplication hostedAppxApplication) {
|
|
||||||
this.hostedAppxApplication = hostedAppxApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HostedMSIApplication getHostedMSIApplication() {
|
|
||||||
return hostedMSIApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostedMSIApplication(HostedMSIApplication hostedMSIApplication) {
|
|
||||||
this.hostedMSIApplication = hostedMSIApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void validateRequest() throws ProfileConfigurationException {
|
|
||||||
if (getHostedAppxApplication() != null) {
|
|
||||||
if (isNullOrEmpty(getHostedAppxApplication().getpackageUri())) {
|
|
||||||
throw new ProfileConfigurationException(
|
|
||||||
"Appx package URL is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
if (isNullOrEmpty(getHostedAppxApplication().getpackageFamilyName())) {
|
|
||||||
throw new ProfileConfigurationException(
|
|
||||||
"Appx package Family Name is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
} else if (getHostedMSIApplication() != null) {
|
|
||||||
if (isNullOrEmpty(getHostedMSIApplication().getProductId())) {
|
|
||||||
throw new ProfileConfigurationException(
|
|
||||||
"MSI product ID is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
if (isNullOrEmpty(getHostedMSIApplication().getContentUrl())) {
|
|
||||||
throw new ProfileConfigurationException(
|
|
||||||
"MSI product content download URL is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
if (isNullOrEmpty(getHostedMSIApplication().getFileHash())) {
|
|
||||||
throw new ProfileConfigurationException(
|
|
||||||
"MSI product file hash is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ProfileConfigurationException("MSI or APPX payload is not found for enterprise app installation");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Object> createOperationContent(Operation operation) throws WindowsOperationException {
|
|
||||||
List<Object> enterpriseApplicationContent = new ArrayList<>();
|
|
||||||
if (getHostedAppxApplication() != null) {
|
|
||||||
enterpriseApplicationContent.addAll(createAddTag(operation.getId(),
|
|
||||||
OperationCode.Command.INSTALL_ENTERPRISE_APPX_APPLICATION.getCode(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.PACKAGE_FAMILY_NAME,
|
|
||||||
getHostedAppxApplication().getpackageFamilyName(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.TYPE_APPX));
|
|
||||||
enterpriseApplicationContent.addAll(createExecuteTag(operation.getId(),
|
|
||||||
OperationCode.Command.INSTALL_ENTERPRISE_APPX_APPLICATION.getCode(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.PACKAGE_FAMILY_NAME,
|
|
||||||
getHostedAppxApplication().getpackageFamilyName()
|
|
||||||
+ PluginConstants.ApplicationInstallProperties.HOSTED_INSTALL,
|
|
||||||
PluginConstants.ApplicationInstallProperties.TYPE_APPX));
|
|
||||||
} else if (getHostedMSIApplication() != null) {
|
|
||||||
enterpriseApplicationContent.addAll(createAddTag(operation.getId(),
|
|
||||||
OperationCode.Command.INSTALL_ENTERPRISE_MSI_APPLICATION.getCode(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.PRODUCT_ID, getHostedMSIApplication().getProductId(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.TYPE_MSI));
|
|
||||||
enterpriseApplicationContent.addAll(createExecuteTag(operation.getId(),
|
|
||||||
OperationCode.Command.INSTALL_ENTERPRISE_MSI_APPLICATION.getCode(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.PRODUCT_ID, getHostedMSIApplication().getProductId(),
|
|
||||||
PluginConstants.ApplicationInstallProperties.TYPE_MSI));
|
|
||||||
}
|
|
||||||
return enterpriseApplicationContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Create add objects required for APPX or MSI application installation which then will be converted as AddTag
|
|
||||||
* elements to add in SyncML XML.
|
|
||||||
*
|
|
||||||
* @param operationId used to set as command ID
|
|
||||||
* @param operationCode is the LocURI
|
|
||||||
* @param replaceOld operation code placeholder
|
|
||||||
* @param replaceNew replace value of operation code placeholder
|
|
||||||
* @param appType APPX or MSI
|
|
||||||
* @return list of AddTag objects
|
|
||||||
*/
|
|
||||||
private List<AddTag> createAddTag(int operationId, String operationCode, String replaceOld, String replaceNew,
|
|
||||||
String appType) {
|
|
||||||
List<AddTag> addTagList = new ArrayList<>();
|
|
||||||
List<ItemTag> itemTagList = new ArrayList<>();
|
|
||||||
AddTag addTag = new AddTag();
|
|
||||||
ItemTag itemTag = new ItemTag();
|
|
||||||
TargetTag targetTag = new TargetTag();
|
|
||||||
String locUri = operationCode.replace(replaceOld, replaceNew);
|
|
||||||
targetTag.setLocURI(locUri);
|
|
||||||
itemTag.setTarget(targetTag);
|
|
||||||
itemTagList.add(itemTag);
|
|
||||||
addTag.setCommandId(operationId);
|
|
||||||
addTag.setItems(itemTagList);
|
|
||||||
addTagList.add(addTag);
|
|
||||||
if (PluginConstants.ApplicationInstallProperties.TYPE_APPX.equals(appType)) {
|
|
||||||
if (!isNullOrEmpty(getHostedAppxApplication().getCertificateHash()) && !isNullOrEmpty(
|
|
||||||
getHostedAppxApplication().getEncodedCertificate())) {
|
|
||||||
List<ItemTag> certItemTagList = new ArrayList<>();
|
|
||||||
AddTag certAddTag = new AddTag();
|
|
||||||
ItemTag certItemTag = new ItemTag();
|
|
||||||
MetaTag certMetaTag = new MetaTag();
|
|
||||||
TargetTag certTargetTag = new TargetTag();
|
|
||||||
certTargetTag.setLocURI(OperationCode.Command.INSTALL_ENTERPRISE_APPX_CERTIFICATE.getCode()
|
|
||||||
.replace(PluginConstants.ApplicationInstallProperties.CERT_HASH,
|
|
||||||
getHostedAppxApplication().getCertificateHash()));
|
|
||||||
certMetaTag.setFormat(Constants.META_FORMAT_B64);
|
|
||||||
certItemTag.setTarget(certTargetTag);
|
|
||||||
certItemTag.setMeta(certMetaTag);
|
|
||||||
certItemTag.setData(getHostedAppxApplication().getEncodedCertificate());
|
|
||||||
certItemTagList.add(certItemTag);
|
|
||||||
certAddTag.setCommandId(operationId);
|
|
||||||
certAddTag.setItems(certItemTagList);
|
|
||||||
addTagList.add(certAddTag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return addTagList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Create execute objects required for APPX or MSI application installation which then will be converted as
|
|
||||||
* ExecuteTag elements to add in SyncML XML.
|
|
||||||
*
|
|
||||||
* @param operationId used to set as command ID
|
|
||||||
* @param operationCode is the LocURI
|
|
||||||
* @param replaceOld operation code placeholder
|
|
||||||
* @param replaceNew replace value of operation code placeholder
|
|
||||||
* @param appType APPX or MSI
|
|
||||||
* @return list of ExecuteTag objects
|
|
||||||
* @throws WindowsOperationException
|
|
||||||
*/
|
|
||||||
private List<ExecuteTag> createExecuteTag(int operationId, String operationCode, String replaceOld,
|
|
||||||
String replaceNew, String appType) throws WindowsOperationException {
|
|
||||||
List<ExecuteTag> executeTagList = new ArrayList<>();
|
|
||||||
List<ItemTag> itemTagList = new ArrayList<>();
|
|
||||||
ExecuteTag executeTag = new ExecuteTag();
|
|
||||||
ItemTag itemTag = new ItemTag();
|
|
||||||
MetaTag metaTag = new MetaTag();
|
|
||||||
TargetTag targetTag = new TargetTag();
|
|
||||||
Document document;
|
|
||||||
Element dependencyElement;
|
|
||||||
targetTag.setLocURI(operationCode.replace(replaceOld, replaceNew));
|
|
||||||
metaTag.setFormat(Constants.META_FORMAT_XML);
|
|
||||||
try {
|
|
||||||
if (PluginConstants.ApplicationInstallProperties.TYPE_APPX.equals(appType)) {
|
|
||||||
document = SyncmlGenerator.generateDocument();
|
|
||||||
Element applicationElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.APPLICATION);
|
|
||||||
applicationElement.setAttribute(PluginConstants.ApplicationInstallProperties.PACKAGE_URI,
|
|
||||||
getHostedAppxApplication().getpackageUri());
|
|
||||||
if (!isNullOrEmpty(getHostedAppxApplication().getDependencyPackageUri())) {
|
|
||||||
Element dependenciesElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.DEPENDENCIES);
|
|
||||||
for (String dependency : getHostedAppxApplication().getDependencyPackageUri()) {
|
|
||||||
dependencyElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.DEPENDENCY);
|
|
||||||
dependencyElement
|
|
||||||
.setAttribute(PluginConstants.ApplicationInstallProperties.PACKAGE_URI, dependency);
|
|
||||||
dependenciesElement.appendChild(dependencyElement);
|
|
||||||
}
|
|
||||||
applicationElement.appendChild(dependenciesElement);
|
|
||||||
}
|
|
||||||
itemTag.setElementData(applicationElement);
|
|
||||||
} else if (PluginConstants.ApplicationInstallProperties.TYPE_MSI.equals(appType)) {
|
|
||||||
metaTag.setType(Constants.META_TYPE_TEXT_PLAIN);
|
|
||||||
document = SyncmlGenerator.generateDocument();
|
|
||||||
Element contentURLElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.CONTENT_URL);
|
|
||||||
contentURLElement.setTextContent(getHostedMSIApplication().getContentUrl());
|
|
||||||
Element contentURLListElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.CONTENT_URL_LIST);
|
|
||||||
contentURLListElement.appendChild(contentURLElement);
|
|
||||||
Element downloadElement = document.createElement(PluginConstants.ApplicationInstallProperties.DOWNLOAD);
|
|
||||||
downloadElement.appendChild(contentURLListElement);
|
|
||||||
Element fileHashElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.FILE_HASH);
|
|
||||||
fileHashElement.setTextContent(getHostedMSIApplication().getFileHash());
|
|
||||||
Element validationElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.VALIDATION);
|
|
||||||
validationElement.appendChild(fileHashElement);
|
|
||||||
Element enforcementElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.ENFORCEMENT);
|
|
||||||
Element commandLineElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.COMMAND_LINE);
|
|
||||||
commandLineElement.setTextContent(PluginConstants.ApplicationInstallProperties.COMMAND_LINE_VALUE);
|
|
||||||
enforcementElement.appendChild(commandLineElement);
|
|
||||||
Element timeOutElement = document.createElement(PluginConstants.ApplicationInstallProperties.TIMEOUT);
|
|
||||||
timeOutElement.setTextContent(PluginConstants.ApplicationInstallProperties.TIMEOUT_VALUE);
|
|
||||||
enforcementElement.appendChild(timeOutElement);
|
|
||||||
Element retryCountElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.RETRY_COUNT);
|
|
||||||
retryCountElement.setTextContent(PluginConstants.ApplicationInstallProperties.RETRY_COUNT_VALUE);
|
|
||||||
enforcementElement.appendChild(retryCountElement);
|
|
||||||
Element retryIntervalElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.RETRY_INTERVAL);
|
|
||||||
retryIntervalElement.setTextContent(PluginConstants.ApplicationInstallProperties.RETRY_INTERVAL_VALUE);
|
|
||||||
enforcementElement.appendChild(retryIntervalElement);
|
|
||||||
Element productElement = document.createElement(PluginConstants.ApplicationInstallProperties.PRODUCT);
|
|
||||||
productElement.setAttribute(PluginConstants.ApplicationInstallProperties.VERSION,
|
|
||||||
PluginConstants.ApplicationInstallProperties.VERSION_VALUE);
|
|
||||||
productElement.appendChild(downloadElement);
|
|
||||||
productElement.appendChild(validationElement);
|
|
||||||
productElement.appendChild(enforcementElement);
|
|
||||||
Element msiInstallJobElement = document
|
|
||||||
.createElement(PluginConstants.ApplicationInstallProperties.MSI_INSTALL_JOB);
|
|
||||||
msiInstallJobElement.setAttribute(PluginConstants.ApplicationInstallProperties.ID,
|
|
||||||
PluginConstants.ApplicationInstallProperties.URL_ESCAPED_OPEN_CURLY + getHostedMSIApplication()
|
|
||||||
.getProductId() + PluginConstants.ApplicationInstallProperties.URL_ESCAPED_CLOSE_CURLY);
|
|
||||||
msiInstallJobElement.appendChild(productElement);
|
|
||||||
itemTag.setElementData(msiInstallJobElement);
|
|
||||||
}
|
|
||||||
} catch (SyncmlOperationException e) {
|
|
||||||
String errorMsg = "Error occurred while generating a document to add as a node to Data element of Execute "
|
|
||||||
+ "command which is required to Install " + appType + " application.";
|
|
||||||
log.error(errorMsg);
|
|
||||||
throw new WindowsOperationException(errorMsg, e);
|
|
||||||
}
|
|
||||||
itemTag.setTarget(targetTag);
|
|
||||||
itemTag.setMeta(metaTag);
|
|
||||||
itemTagList.add(itemTag);
|
|
||||||
executeTag.setCommandId(operationId);
|
|
||||||
executeTag.setItems(itemTagList);
|
|
||||||
executeTagList.add(executeTag);
|
|
||||||
return executeTagList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.bean;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HostedAppxApplication {
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "packageUri", value = "Package URL.", required = true)
|
|
||||||
private String packageUri;
|
|
||||||
@ApiModelProperty(name = "packageFamilyName", value = "Package family name.", required = true)
|
|
||||||
private String packageFamilyName;
|
|
||||||
@ApiModelProperty(name = "dependencyPackageURLs", value = "Dependency Package URLs.")
|
|
||||||
private List<String> dependencyPackageUri;
|
|
||||||
@ApiModelProperty(name = "certificateHash", value = "Application signed SHA1 certificate hash.")
|
|
||||||
private String certificateHash;
|
|
||||||
@ApiModelProperty(name = "encodedCertificate", value = "Application signed Base64 encoded certificate.")
|
|
||||||
private String encodedCertificate;
|
|
||||||
|
|
||||||
public String getpackageUri() {
|
|
||||||
return packageUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setpackageUri (String packageUri) {
|
|
||||||
this.packageUri = packageUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getpackageFamilyName() {
|
|
||||||
return packageFamilyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setpackageFamilyName(String packageFamilyName) {
|
|
||||||
this.packageFamilyName = packageFamilyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getDependencyPackageUri() {
|
|
||||||
return dependencyPackageUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDependencyPackageUri(List<String> dependencyPackageUri) {
|
|
||||||
this.dependencyPackageUri = dependencyPackageUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCertificateHash() {
|
|
||||||
return certificateHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCertificateHash(String certificateHash) {
|
|
||||||
this.certificateHash = certificateHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEncodedCertificate() {
|
|
||||||
return encodedCertificate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEncodedCertificate(String encodedCertificate) {
|
|
||||||
this.encodedCertificate = encodedCertificate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.bean;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
public class HostedMSIApplication {
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "productId", value = "Product ID.", required = true)
|
|
||||||
private String productId;
|
|
||||||
@ApiModelProperty(name = "contentUrl", value = "Content URL.", required = true)
|
|
||||||
private String contentUrl;
|
|
||||||
@ApiModelProperty(name = "fileHash", value = "File Hash.", required = true)
|
|
||||||
private String fileHash;
|
|
||||||
|
|
||||||
public String getProductId() {
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductId(String productId) {
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContentUrl() {
|
|
||||||
return contentUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContentUrl(String contentUrl) {
|
|
||||||
this.contentUrl = contentUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileHash() {
|
|
||||||
return fileHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileHash(String fileHash) {
|
|
||||||
this.fileHash = fileHash;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.bean;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* This abstract class is used for extending generic functions with regard to operation.
|
|
||||||
*/
|
|
||||||
public abstract class WindowsOperation {
|
|
||||||
|
|
||||||
public abstract List<Object> createOperationContent(Operation operation) throws WindowsOperationException;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Converts operation object to a json format.
|
|
||||||
*
|
|
||||||
* @return JSON formatted String
|
|
||||||
*/
|
|
||||||
public String toJSON() {
|
|
||||||
Gson gson = new Gson();
|
|
||||||
return gson.toJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given string is null or empty
|
|
||||||
*
|
|
||||||
* @param value string value to check
|
|
||||||
* @return boolean value of null or empty
|
|
||||||
*/
|
|
||||||
public boolean isNullOrEmpty(String value) {
|
|
||||||
return value == null || value.trim().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Checks if the given list is null or empty
|
|
||||||
*
|
|
||||||
* @param value string list value to check
|
|
||||||
* @return boolean value of null or empty
|
|
||||||
*/
|
|
||||||
public boolean isNullOrEmpty(List<String> value) {
|
|
||||||
return value == null || value.isEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.bean.wrapper;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.bean.EnterpriseApplication;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ApiModel(value = "EnterpriseApplicationBeanWrapper",
|
|
||||||
description = "Information related to Enterprise Application.")
|
|
||||||
public class EnterpriseApplicationBeanWrapper {
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "deviceIDs",
|
|
||||||
value = "List of device Ids to be need to execute operation.", required = true)
|
|
||||||
private List<String> deviceIDs;
|
|
||||||
@ApiModelProperty(name = "operation",
|
|
||||||
value = "Enterprise Application.", required = true)
|
|
||||||
private EnterpriseApplication operation;
|
|
||||||
|
|
||||||
public List<String> getDeviceIDs() {
|
|
||||||
return deviceIDs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceIDs(List<String> deviceIDs) {
|
|
||||||
this.deviceIDs = deviceIDs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnterpriseApplication getOperation() {
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOperation(EnterpriseApplication operation) {
|
|
||||||
this.operation = operation;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,422 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. 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 org.wso2.carbon.device.mgt.mobile.windows.api.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PluginConstants class for Windows plugin. This class has inner classes for containing constants for
|
|
||||||
* each service.
|
|
||||||
*/
|
|
||||||
public final class PluginConstants {
|
|
||||||
|
|
||||||
//Service endpoints
|
|
||||||
public static final String DISCOVERY_SERVICE_ENDPOINT =
|
|
||||||
"org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.DiscoveryService";
|
|
||||||
public static final String CERTIFICATE_ENROLLMENT_SERVICE_ENDPOINT =
|
|
||||||
"org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.CertificateEnrollmentService";
|
|
||||||
public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_ENDPOINT =
|
|
||||||
"org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.CertificateEnrollmentPolicyService";
|
|
||||||
public static final String ENROLLMENT_SERVICE_ENDPOINT =
|
|
||||||
"org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.EnrollmentService";
|
|
||||||
|
|
||||||
//Services' target namespaces
|
|
||||||
public static final String DISCOVERY_SERVICE_TARGET_NAMESPACE =
|
|
||||||
"http://schemas.microsoft.com/windows/management/2012/01/enrollment";
|
|
||||||
public static final String DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE =
|
|
||||||
"http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC";
|
|
||||||
public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE =
|
|
||||||
"http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy";
|
|
||||||
|
|
||||||
//Certificate enrollment service urls and namespaces
|
|
||||||
public static final String WS_TRUST_TARGET_NAMESPACE =
|
|
||||||
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";
|
|
||||||
public static final String WS_SECURITY_TARGET_NAMESPACE =
|
|
||||||
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
|
|
||||||
public static final String SOAP_AUTHORIZATION_TARGET_NAMESPACE =
|
|
||||||
"http://schemas.xmlsoap.org/ws/2006/12/authorization";
|
|
||||||
|
|
||||||
//Certificate enrollment policy service urls and namespaces
|
|
||||||
public static final String ENROLLMENT_POLICY_TARGET_NAMESPACE =
|
|
||||||
"http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy";
|
|
||||||
public static final String REQUEST_WRAPPER_CLASS_NAME =
|
|
||||||
"com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPolicies";
|
|
||||||
public static final String RESPONSE_WRAPPER_CLASS_NAME =
|
|
||||||
"com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPoliciesResponse";
|
|
||||||
|
|
||||||
//Servlet Context attributes names
|
|
||||||
public static final String CONTEXT_WAP_PROVISIONING_FILE = "WAP_PROVISIONING_FILE";
|
|
||||||
|
|
||||||
//Message handler constants
|
|
||||||
public static final String CONTENT_LENGTH = "Content-Length";
|
|
||||||
public static final String SECURITY = "Security";
|
|
||||||
public static final String TO = "To";
|
|
||||||
public static final String CXF_REQUEST_URI = "org.apache.cxf.request.uri";
|
|
||||||
|
|
||||||
//Web services media types
|
|
||||||
public static final String SYNCML_MEDIA_TYPE = "application/vnd.syncml.dm+xml";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Discovery service related other constants
|
|
||||||
*/
|
|
||||||
public final class Discovery {
|
|
||||||
private Discovery() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String DEVICE_ENROLLMENT_SUBDOMAIN = "https://EnterpriseEnrollment.";
|
|
||||||
public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_URL =
|
|
||||||
"/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc";
|
|
||||||
public static final String CERTIFICATE_ENROLLMENT_SERVICE_URL =
|
|
||||||
"/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc";
|
|
||||||
public static final String ENROLLMENT_SERVICE_URL =
|
|
||||||
"/ENROLLMENTSERVER/Win10DeviceEnrollmentWebservice.svc";
|
|
||||||
public static final String WAB_URL = "/windows-web-agent/enrollments/windows/login-agent";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Certificate enrolment policy service related constants
|
|
||||||
*/
|
|
||||||
public final class CertificateEnrolmentPolicy {
|
|
||||||
private CertificateEnrolmentPolicy() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final int MINIMAL_KEY_LENGTH = 2048;
|
|
||||||
public static final int POLICY_SCHEMA = 3;
|
|
||||||
public static final int HASH_ALGORITHM_OID_REFERENCE = 0;
|
|
||||||
public static final int OID_REFERENCE = 0;
|
|
||||||
public static final String OID = "1.3.14.3.2.29";
|
|
||||||
public static final String OID_DEFAULT_NAME = "szOID_OIWSEC_sha1RSASign";
|
|
||||||
public static final int OID_GROUP = 1;
|
|
||||||
public static final int OID_REFERENCE_ID = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Certificate enrollment Service related constants.
|
|
||||||
*/
|
|
||||||
public final class CertificateEnrolment {
|
|
||||||
private CertificateEnrolment() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String TOKEN_TYPE =
|
|
||||||
"http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken";
|
|
||||||
public static final String PARM = "parm";
|
|
||||||
public static final String TYPE = "type";
|
|
||||||
public static final String VALUE = "value";
|
|
||||||
public static final String VALUE_TYPE =
|
|
||||||
"http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentProvisionDoc";
|
|
||||||
public static final String ENCODING_TYPE =
|
|
||||||
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary";
|
|
||||||
public static final String CA_CERT = "cacert";
|
|
||||||
public static final String X_509 = "X.509";
|
|
||||||
public static final String WAP_PROVISIONING_XML = "wap-provisioning.xml";
|
|
||||||
public static final String PROVIDER = "BC";
|
|
||||||
public static final String ALGORITHM = "SHA1withRSA";
|
|
||||||
public static final String JKS = "JKS";
|
|
||||||
public static final String SECURITY = "Security";
|
|
||||||
public static final String WSS_SECURITY_UTILITY =
|
|
||||||
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
|
|
||||||
public static final String TIMESTAMP_ID = "Id";
|
|
||||||
public static final String TIMESTAMP_U = "u";
|
|
||||||
public static final String TIMESTAMP = "Timestamp";
|
|
||||||
public static final String TIMESTAMP_0 = "_0";
|
|
||||||
public static final String CREATED = "Created";
|
|
||||||
public static final String EXPIRES = "Expires";
|
|
||||||
public static final String UTF_8 = "utf-8";
|
|
||||||
|
|
||||||
public static final int DOMAIN_SEGMENT = 1;
|
|
||||||
public static final int EMAIL_SEGMENT = 0;
|
|
||||||
public static final int REQUEST_ID = 0;
|
|
||||||
public static final int CA_CERTIFICATE_POSITION = 0;
|
|
||||||
public static final int SIGNED_CERTIFICATE_POSITION = 1;
|
|
||||||
public static final int APPAUTH_USERNAME_POSITION = 21;
|
|
||||||
public static final int APPAUTH_PASSWORD_POSITION = 22;
|
|
||||||
public static final int POLLING_FREQUENCY_POSITION = 24;
|
|
||||||
public static final int SYNCML_PROVISIONING_ADDR_POSITION = 8;
|
|
||||||
public static final int DOMAIN_POSITION = 7;
|
|
||||||
public static final String ENROLL_SUBDOMAIN = "https://EnterpriseEnrollment.";
|
|
||||||
public static final String SYNCML_PROVISIONING_SERVICE_URL = "/Syncml/initialquery";
|
|
||||||
public static final String SYNCML_PROVISIONING_WIN10_SERVICE_URL = "/devicemgt";
|
|
||||||
public static final String ENROLLMENT_DISPOSITION_MESSAGE = "http://schemas.microsoft.com/windows/pki/" +
|
|
||||||
"2009/01/enrollment";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SynclML service related constants.
|
|
||||||
*/
|
|
||||||
public final class SyncML {
|
|
||||||
private SyncML() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String SYNCML_SOURCE = "Source";
|
|
||||||
public static final String SYNCML_DATA = "Data";
|
|
||||||
public static final String SYNCML_META = "Meta";
|
|
||||||
public static final String SYNCML_CMD = "Cmd";
|
|
||||||
public static final String SYNCML_CHAL = "ChallengeTag";
|
|
||||||
public static final String SYNCML_CMD_ID = "CmdID";
|
|
||||||
public static final String SYNCML_CMD_REF = "CmdRef";
|
|
||||||
public static final String SYNCML_MESSAGE_REF = "MsgRef";
|
|
||||||
public static final String SYNCML_LOCATION_URI = "LocURI";
|
|
||||||
public static final String SYNCML_TARGET_REF = "TargetRef";
|
|
||||||
|
|
||||||
public static final int SYNCML_FIRST_MESSAGE_ID = 1;
|
|
||||||
public static final int SYNCML_SECOND_MESSAGE_ID = 2;
|
|
||||||
public static final int SYNCML_FIRST_SESSION_ID = 1;
|
|
||||||
public static final int SYNCML_SECOND_SESSION_ID = 2;
|
|
||||||
public static final int OSVERSION_POSITION = 0;
|
|
||||||
public static final int DEVICE_ID_POSITION = 0;
|
|
||||||
public static final int DEVICE_MODEL_POSITION = 2;
|
|
||||||
public static final int DEVICE_MAN_POSITION = 1;
|
|
||||||
public static final int DEVICE_MOD_VER_POSITION = 3;
|
|
||||||
public static final int DEVICE_LANG_POSITION = 4;
|
|
||||||
public static final int IMSI_POSITION = 1;
|
|
||||||
public static final int IMEI_POSITION = 2;
|
|
||||||
public static final int VENDOR_POSITION = 4;
|
|
||||||
public static final int MODEL_POSITION = 5;
|
|
||||||
public static final int MAC_ADDRESS_POSITION = 7;
|
|
||||||
public static final int RESOLUTION_POSITION = 8;
|
|
||||||
public static final int DEVICE_NAME_POSITION = 10;
|
|
||||||
public static final String SYNCML_DATA_ONE = "1";
|
|
||||||
public static final String SYNCML_DATA_ZERO = "0";
|
|
||||||
public static final String OS_VERSION = "OS_VERSION";
|
|
||||||
public static final String IMSI = "IMSI";
|
|
||||||
public static final String IMEI = "IMEI";
|
|
||||||
public static final String VENDOR = "VENDOR";
|
|
||||||
public static final String MODEL = "DEVICE_MODEL";
|
|
||||||
public static final String MAC_ADDRESS = "MAC_ADDRESS";
|
|
||||||
public static final String DEVICE_INFO = "DEVICE_INFO";
|
|
||||||
public static final String DEVICE_NAME = "DEVICE_NAME";
|
|
||||||
public static final String SOFTWARE_VERSION = "SOFTWARE_VERSION";
|
|
||||||
public static final String DEV_ID = "DEV_ID";
|
|
||||||
public static final String MANUFACTURER = "MANUFACTURER";
|
|
||||||
public static final String LANGUAGE = "LANGUAGE";
|
|
||||||
public static final String RESOLUTION = "RESOLUTION";
|
|
||||||
|
|
||||||
// windows 10 codes
|
|
||||||
public static final String TOTAL_RAM = "TOTAL_RAM";// available ram in MB
|
|
||||||
public static final String TOTAL_STORAGE = "TOTAL_STORAGE";
|
|
||||||
public static final String OS_PLATFORM = "OS_PLATFORM";
|
|
||||||
public static final String DEVICE_TYPE = "DEVICE_TYPE";
|
|
||||||
public static final String BATTERY_QUERY = "BATTERY_QUERY";
|
|
||||||
public static final String BATTERY_STATUS = "BATTERY_STATUS";
|
|
||||||
public static final String BATTERY_CHARGE_REMAINING = "BATTERY_CHARGE_REMAINING";
|
|
||||||
public static final String BATTERY_ESTIMATED_RUNTIME = "BATTERY_ESTIMATED_RUNTIME";
|
|
||||||
public static final String MOBILE_ID = "MOBILE_ID";
|
|
||||||
public static final String LONGITUDE = "LONGITUDE";
|
|
||||||
public static final String LATITUDE = "LATITUDE";
|
|
||||||
|
|
||||||
public static final String DEVICE_UNENROLL_META_TYPE = "com.microsoft:mdm.unenrollment.userrequest";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Windows device constants.
|
|
||||||
*/
|
|
||||||
public final class DeviceConstants {
|
|
||||||
private DeviceConstants() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String DEVICE_ID_NOT_FOUND = "Device Id not found for device found at %s";
|
|
||||||
public static final String DEVICE_ID_SERVICE_NOT_FOUND =
|
|
||||||
"Issue in retrieving device management service instance for device found at %s";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Device Operation codes.
|
|
||||||
*/
|
|
||||||
public final class OperationCodes {
|
|
||||||
private OperationCodes() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String DEVICE_LOCK = "DEVICE_LOCK";
|
|
||||||
public static final String DISENROLL = "DISENROLL";
|
|
||||||
public static final String DEVICE_RING = "DEVICE_RING";
|
|
||||||
public static final String WIPE_DATA = "WIPE_DATA";
|
|
||||||
public static final String ENCRYPT_STORAGE = "ENCRYPT_STORAGE";
|
|
||||||
public static final String LOCK_RESET = "LOCK_RESET";
|
|
||||||
public static final String PIN_CODE = "LOCK_PIN";
|
|
||||||
public static final String CAMERA = "CAMERA";
|
|
||||||
public static final String PASSCODE_POLICY = "PASSCODE_POLICY";
|
|
||||||
public static final String PASSWORD_EXPIRE = "PASSWORD_EXPIRE";
|
|
||||||
public static final String PASSWORD_HISTORY = "PASSWORD_HISTORY";
|
|
||||||
public static final String MAX_PASSWORD_INACTIVE_TIME = "MAX_PASSWORD_INACTIVE_TIME";
|
|
||||||
public static final String MIN_PASSWORD_COMPLEX_CHARACTERS = "MIN_PASSWORD_COMPLEX_CHARACTERS";
|
|
||||||
public static final String ALPHANUMERIC_PASSWORD = "ALPHANUMERIC_PASSWORD";
|
|
||||||
public static final String SIMPLE_PASSWORD = "SIMPLE_PASSWORD";
|
|
||||||
public static final String MIN_PASSWORD_LENGTH = "MIN_PASSWORD_LENGTH";
|
|
||||||
public static final String DEVICE_PASSWORD_ENABLE = "DEVICE_PASSWORD_ENABLE";
|
|
||||||
public static final String PASSWORD_MAX_FAIL_ATTEMPTS = "PASSWORD_MAX_FAIL_ATTEMPTS";
|
|
||||||
public static final String MONITOR = "MONITOR";
|
|
||||||
public static final String CAMERA_STATUS = "CAMERA_STATUS";
|
|
||||||
public static final String POLICY_BUNDLE = "POLICY_BUNDLE";
|
|
||||||
public static final String ENCRYPT_STORAGE_STATUS = "ENCRYPT_STORAGE_STATUS";
|
|
||||||
public static final String DEVICE_PASSWORD_STATUS = "DEVICE_PASSWORD_STATUS";
|
|
||||||
public static final String DEVICE_PASSCODE_DELETE = "DEVICE_PASSCODE_DELETE";
|
|
||||||
public static final String DEVICE_INFO = "DEVICE_INFO";
|
|
||||||
public static final String POLICY_REVOKE = "POLICY_REVOKE";
|
|
||||||
public static final String DEVICE_LOCATION = "DEVICE_LOCATION";
|
|
||||||
public static final String LONGITUDE = "LONGITUDE";
|
|
||||||
public static final String LATITUDE = "LATITUDE";
|
|
||||||
public static final String DEVICE_REBOOT = "DEVICE_REBOOT";
|
|
||||||
public static final String INSTALL_ENTERPRISE_APPLICATION = "INSTALL_ENTERPRISE_APPLICATION";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin response status code constants.
|
|
||||||
*/
|
|
||||||
public final class StatusCodes {
|
|
||||||
private StatusCodes() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final int MULTI_STATUS_HTTP_CODE = 207;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class WindowsConstant {
|
|
||||||
public static final String DEVICE_TYPE_WINDOWS = "windows";
|
|
||||||
public static final String HEADER_CONTENT_TYPE = "Content-Type";
|
|
||||||
public static final String APPLICATION_JSON = "application/json";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tenant Configuration related constants.
|
|
||||||
*/
|
|
||||||
public final class TenantConfigProperties {
|
|
||||||
private TenantConfigProperties() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String LICENSE_KEY = "windowsLicense";
|
|
||||||
public static final String LANGUAGE_US = "en_US";
|
|
||||||
public static final String CONTENT_TYPE_TEXT = "text";
|
|
||||||
public static final String NOTIFIER_FREQUENCY = "notifierFrequency";
|
|
||||||
public static final String DEFAULT_FREQUENCY = "8";
|
|
||||||
public static final String AUTH_POLICY = "authPolicy";
|
|
||||||
public static final String DEFAULT_AUTH_POLICY = "Federated";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Policy Configuration related constants.
|
|
||||||
*/
|
|
||||||
public final class PolicyConfigProperties {
|
|
||||||
private PolicyConfigProperties() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String POLICY_ENABLE = "enabled";
|
|
||||||
public static final String ENCRYPTED_ENABLE = "encrypted";
|
|
||||||
public static final String ENABLE_PASSWORD = "enablePassword";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Authentication related constants.
|
|
||||||
*/
|
|
||||||
public final class AuthenticatorProperties {
|
|
||||||
private AuthenticatorProperties() { throw new AssertionError(); }
|
|
||||||
public static final String MAX_CONNECTION_PER_HOST = "MaxConnectionsPerHost";
|
|
||||||
public static final String MAX_TOTAL_CONNECTIONS = "MaxTotalConnections";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Windows version(8.1/10) related constants.
|
|
||||||
*/
|
|
||||||
public final class WindowsVersionProperties {
|
|
||||||
private WindowsVersionProperties() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
public static final String REQUESTED_WIN10_VERSION = "3.0";
|
|
||||||
public static final String REQUESTED_WIN81_VERSION = "2.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Windows10 enrollment property constants.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public final class WindowsEnrollmentProperties {
|
|
||||||
private WindowsEnrollmentProperties() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
public static final String DEVICE_NAME = "DeviceName";
|
|
||||||
public static final String DEVICE_VERSION = "OSVersion";
|
|
||||||
public static final String DEVICE_ID = "DeviceID";
|
|
||||||
public static final String IMEI = "MobileEquipmentId";
|
|
||||||
public static final String TYPE = "DeviceType";
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class ApplicationInstallProperties {
|
|
||||||
private ApplicationInstallProperties() {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
public static final String APPLICATION = "Application";
|
|
||||||
public static final String TYPE_APPX = "APPX";
|
|
||||||
public static final String TYPE_MSI = "MSI";
|
|
||||||
public static final String PACKAGE_FAMILY_NAME = "{PackageFamilyName}";
|
|
||||||
public static final String PRODUCT_ID = "{ProductId}";
|
|
||||||
public static final String CERT_HASH = "{CertHash}";
|
|
||||||
public static final String HOSTED_INSTALL = "/HostedInstall";
|
|
||||||
|
|
||||||
//XML Related Constants
|
|
||||||
public static final String ID = "id";
|
|
||||||
public static final String PACKAGE_URI = "PackageUri";
|
|
||||||
public static final String DEPENDENCIES = "Dependencies";
|
|
||||||
public static final String DEPENDENCY = "Dependency";
|
|
||||||
public static final String CONTENT_URL = "ContentURL";
|
|
||||||
public static final String CONTENT_URL_LIST = "ContentURLList";
|
|
||||||
public static final String DOWNLOAD = "Download";
|
|
||||||
public static final String COMMAND_LINE = "CommandLine";
|
|
||||||
public static final String COMMAND_LINE_VALUE = "/quiet";
|
|
||||||
public static final String FILE_HASH = "FileHash";
|
|
||||||
public static final String VALIDATION = "Validation";
|
|
||||||
public static final String ENFORCEMENT = "Enforcement";
|
|
||||||
public static final String TIMEOUT = "TimeOut";
|
|
||||||
public static final String RETRY_COUNT = "RetryCount";
|
|
||||||
public static final String RETRY_INTERVAL = "RetryInterval";
|
|
||||||
public static final String PRODUCT = "Product";
|
|
||||||
public static final String MSI_INSTALL_JOB = "MsiInstallJob";
|
|
||||||
public static final String VERSION = "version";
|
|
||||||
public static final String VERSION_VALUE = "1.0.0";
|
|
||||||
public static final String TIMEOUT_VALUE = "5";
|
|
||||||
public static final String RETRY_COUNT_VALUE = "3";
|
|
||||||
public static final String RETRY_INTERVAL_VALUE = "5";
|
|
||||||
public static final String LICENSE = "License";
|
|
||||||
public static final String CONTENT = "Content";
|
|
||||||
public static final String URL_ESCAPED_OPEN_CURLY = "%7B";
|
|
||||||
public static final String URL_ESCAPED_CLOSE_CURLY = "%7D";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common;
|
|
||||||
|
|
||||||
public enum SyncmlCommandType {
|
|
||||||
|
|
||||||
WIFI("WIFI");
|
|
||||||
|
|
||||||
private final String commandType;
|
|
||||||
|
|
||||||
SyncmlCommandType(final String commandType) {
|
|
||||||
this.commandType = commandType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return this.commandType;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Declares the contract for OAuth2TokenValidator implementations.
|
|
||||||
*/
|
|
||||||
public interface OAuth2TokenValidator {
|
|
||||||
/**
|
|
||||||
* This method gets a string accessToken and validates it and generate the OAuthValidationResponse
|
|
||||||
* containing the validity and user details if valid.
|
|
||||||
*
|
|
||||||
* @param accessToken which need to be validated.
|
|
||||||
* @param resource which need to be validated.
|
|
||||||
* @return OAuthValidationResponse with the validated results.
|
|
||||||
*/
|
|
||||||
OAuthValidationResponse validateToken(String accessToken, String resource) throws OAuthTokenValidationException;
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator;
|
|
||||||
|
|
||||||
import org.wso2.carbon.utils.CarbonUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines constants to be used inside oauth validators.
|
|
||||||
*/
|
|
||||||
public class OAuthConstants {
|
|
||||||
|
|
||||||
public static final String AUTHORIZATION_HEADER_PREFIX_BEARER = "Bearer";
|
|
||||||
public static final String AUTHORIZATION_HEADER_PREFIX_BASIC = "Basic";
|
|
||||||
public static final String BEARER_TOKEN_TYPE = "bearer";
|
|
||||||
public static final String BEARER_TOKEN_IDENTIFIER = "token";
|
|
||||||
public static final String AUTHENTICATOR_NAME = "OAuthAuthenticator";
|
|
||||||
public static final String RESOURCE_KEY = "resource";
|
|
||||||
public static final String AUTHENTICATOR_CONFIG_PATH = CarbonUtils.getEtcCarbonConfigDirPath() +
|
|
||||||
File.separator + "webapp-authenticator-config.xml";
|
|
||||||
private static final String AUTHENTICATOR_CONFIG_SCHEMA_PATH =
|
|
||||||
"resources/config/schema/webapp-authenticator-config-schema.xsd";
|
|
||||||
}
|
|
@ -1,215 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator;
|
|
||||||
|
|
||||||
import org.apache.axis2.AxisFault;
|
|
||||||
import org.apache.axis2.client.Options;
|
|
||||||
import org.apache.axis2.client.ServiceClient;
|
|
||||||
import org.apache.axis2.transport.http.HTTPConstants;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.commons.httpclient.Header;
|
|
||||||
import org.apache.commons.httpclient.HttpClient;
|
|
||||||
import org.apache.commons.httpclient.HttpConnectionManager;
|
|
||||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
|
||||||
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.apache.commons.pool.PoolableObjectFactory;
|
|
||||||
import org.apache.http.conn.HttpClientConnectionManager;
|
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class OAuthTokenValidationStubFactory implements PoolableObjectFactory {
|
|
||||||
private String url;
|
|
||||||
private String basicAuthHeader;
|
|
||||||
private HttpClient httpClient;
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(
|
|
||||||
org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthTokenValidationStubFactory.class);
|
|
||||||
|
|
||||||
public OAuthTokenValidationStubFactory(String url, String adminUsername, String adminPassword,
|
|
||||||
Properties properties) {
|
|
||||||
this.validateUrl(url);
|
|
||||||
this.url = url;
|
|
||||||
|
|
||||||
this.validateCredentials(adminUsername, adminPassword);
|
|
||||||
this.basicAuthHeader = new String(Base64.encodeBase64((adminUsername + ":" + adminPassword).getBytes()));
|
|
||||||
|
|
||||||
HttpConnectionManager connectionManager = this.createConnectionManager(properties);
|
|
||||||
this.httpClient = new HttpClient(connectionManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of MultiThreadedHttpConnectionManager using HttpClient 3.x APIs
|
|
||||||
*
|
|
||||||
* @param properties Properties to configure MultiThreadedHttpConnectionManager
|
|
||||||
* @return An instance of properly configured MultiThreadedHttpConnectionManager
|
|
||||||
*/
|
|
||||||
private HttpConnectionManager createConnectionManager(Properties properties) {
|
|
||||||
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
|
|
||||||
if (properties == null || properties.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("Parameters required to initialize HttpClient instances " +
|
|
||||||
"associated with OAuth token validation service stub are not provided");
|
|
||||||
}
|
|
||||||
String maxConnectionsPerHostParam = properties.getProperty(PluginConstants.
|
|
||||||
AuthenticatorProperties.MAX_CONNECTION_PER_HOST);
|
|
||||||
if (maxConnectionsPerHostParam == null || maxConnectionsPerHostParam.isEmpty()) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("MaxConnectionsPerHost parameter is not explicitly defined. Therefore, the default, " +
|
|
||||||
"which is 2, will be used");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
params.setDefaultMaxConnectionsPerHost(Integer.parseInt(maxConnectionsPerHostParam));
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxTotalConnectionsParam = properties.getProperty(PluginConstants.
|
|
||||||
AuthenticatorProperties.MAX_TOTAL_CONNECTIONS);
|
|
||||||
if (maxTotalConnectionsParam == null || maxTotalConnectionsParam.isEmpty()) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("MaxTotalConnections parameter is not explicitly defined. Therefore, the default, " +
|
|
||||||
"which is 10, will be used");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
params.setMaxTotalConnections(Integer.parseInt(maxTotalConnectionsParam));
|
|
||||||
}
|
|
||||||
HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
|
|
||||||
connectionManager.setParams(params);
|
|
||||||
return connectionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of PoolingHttpClientConnectionManager using HttpClient 4.x APIs
|
|
||||||
*
|
|
||||||
* @param properties Properties to configure PoolingHttpClientConnectionManager
|
|
||||||
* @return An instance of properly configured PoolingHttpClientConnectionManager
|
|
||||||
*/
|
|
||||||
private HttpClientConnectionManager createClientConnectionManager(Properties properties) {
|
|
||||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
|
|
||||||
if (properties != null) {
|
|
||||||
String maxConnectionsPerHostParam = properties.getProperty(PluginConstants.
|
|
||||||
AuthenticatorProperties.MAX_CONNECTION_PER_HOST);
|
|
||||||
if (maxConnectionsPerHostParam == null || maxConnectionsPerHostParam.isEmpty()) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("MaxConnectionsPerHost parameter is not explicitly defined. Therefore, the default, " +
|
|
||||||
"which is 2, will be used");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
connectionManager.setDefaultMaxPerRoute(Integer.parseInt(maxConnectionsPerHostParam));
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxTotalConnectionsParam = properties.getProperty(PluginConstants.
|
|
||||||
AuthenticatorProperties.MAX_TOTAL_CONNECTIONS);
|
|
||||||
if (maxTotalConnectionsParam == null || maxTotalConnectionsParam.isEmpty()) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("MaxTotalConnections parameter is not explicitly defined. Therefore, the default, " +
|
|
||||||
"which is 10, will be used");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
connectionManager.setMaxTotal(Integer.parseInt(maxTotalConnectionsParam));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Properties, i.e. MaxTotalConnections/MaxConnectionsPerHost, required to tune the " +
|
|
||||||
"HttpClient used in OAuth token validation service stub instances are not provided. " +
|
|
||||||
"Therefore, the defaults, 2/10 respectively, will be used");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return connectionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object makeObject() throws Exception {
|
|
||||||
return this.createStub();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void destroyObject(Object o) throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean validateObject(Object o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void activateObject(Object o) throws Exception {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("OAuth token validate stub instance is activated");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void passivateObject(Object o) throws Exception {
|
|
||||||
if (o instanceof OAuth2TokenValidationServiceStub) {
|
|
||||||
OAuth2TokenValidationServiceStub stub = (OAuth2TokenValidationServiceStub) o;
|
|
||||||
stub._getServiceClient().cleanupTransport();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private OAuth2TokenValidationServiceStub createStub() throws OAuthTokenValidationException {
|
|
||||||
OAuth2TokenValidationServiceStub stub;
|
|
||||||
try {
|
|
||||||
stub = new OAuth2TokenValidationServiceStub(url);
|
|
||||||
ServiceClient client = stub._getServiceClient();
|
|
||||||
client.getServiceContext().getConfigurationContext().setProperty(
|
|
||||||
HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
|
|
||||||
|
|
||||||
List<Header> headerList = new ArrayList<>();
|
|
||||||
Header header = new Header();
|
|
||||||
header.setName(HTTPConstants.HEADER_AUTHORIZATION);
|
|
||||||
header.setValue(OAuthConstants.AUTHORIZATION_HEADER_PREFIX_BASIC + " " + basicAuthHeader);
|
|
||||||
headerList.add(header);
|
|
||||||
|
|
||||||
Options options = client.getOptions();
|
|
||||||
options.setProperty(HTTPConstants.HTTP_HEADERS, headerList);
|
|
||||||
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");
|
|
||||||
client.setOptions(options);
|
|
||||||
} catch (AxisFault axisFault) {
|
|
||||||
throw new OAuthTokenValidationException("Error occurred while creating the " +
|
|
||||||
"OAuth2TokenValidationServiceStub.", axisFault);
|
|
||||||
}
|
|
||||||
return stub;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateUrl(String url) {
|
|
||||||
if (url == null || url.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("Url provided as the endpoint of the OAuth token validation service " +
|
|
||||||
"is null");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateCredentials(String adminUsername, String adminPassword) {
|
|
||||||
if (adminUsername == null || adminUsername.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("An appropriate username required to initialize OAuth token " +
|
|
||||||
"validation service stub factory hasn't been provided");
|
|
||||||
}
|
|
||||||
if (adminPassword == null || adminPassword.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("An appropriate password required to initialize OAuth token " +
|
|
||||||
"validation service stub factory hasn't been provided");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.LocalOAuthValidator;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.RemoteOAuthValidator;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
|
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class validate the configurations and provide the most suitable implementation according to the configuration.
|
|
||||||
* Factory class for OAuthValidator.
|
|
||||||
*/
|
|
||||||
public class OAuthValidatorFactory {
|
|
||||||
|
|
||||||
private static Properties authenticatorProperties;
|
|
||||||
|
|
||||||
public static OAuth2TokenValidator getValidator() {
|
|
||||||
Properties authenticatorProperties = getAuthenticatorProperties();
|
|
||||||
boolean isRemote = Boolean.parseBoolean(authenticatorProperties.getProperty("IsRemote"));
|
|
||||||
if (isRemote) {
|
|
||||||
String url = authenticatorProperties.getProperty("TokenValidationEndpointUrl");
|
|
||||||
if ((url == null) || (url.isEmpty())) {
|
|
||||||
throw new IllegalStateException("OAuth token validation endpoint url is not provided");
|
|
||||||
}
|
|
||||||
String adminUsername = authenticatorProperties.getProperty("Username");
|
|
||||||
if (adminUsername == null) {
|
|
||||||
throw new IllegalStateException("Username to connect to the OAuth token validation endpoint " +
|
|
||||||
"is not provided");
|
|
||||||
}
|
|
||||||
|
|
||||||
String adminPassword = authenticatorProperties.getProperty("Password");
|
|
||||||
if (adminPassword == null) {
|
|
||||||
throw new IllegalStateException("Password to connect to the OAuth token validation endpoint " +
|
|
||||||
"is not provided");
|
|
||||||
}
|
|
||||||
|
|
||||||
Properties validatorProperties = new Properties();
|
|
||||||
validatorProperties.setProperty("MaxTotalConnections", authenticatorProperties.getProperty("MaxTotalConnections"));
|
|
||||||
validatorProperties.setProperty("MaxConnectionsPerHost", authenticatorProperties.getProperty("MaxConnectionsPerHost"));
|
|
||||||
if ((url != null) && (!url.trim().isEmpty())) {
|
|
||||||
url = url + "/services/OAuth2TokenValidationService.OAuth2TokenValidationServiceHttpsSoap12Endpoint/";
|
|
||||||
return new RemoteOAuthValidator(url, adminUsername, adminPassword, validatorProperties);
|
|
||||||
}
|
|
||||||
throw new IllegalStateException("Remote server host can't be empty in OAuthAuthenticator configuration.");
|
|
||||||
}
|
|
||||||
return new LocalOAuthValidator();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Properties getAuthenticatorProperties() {
|
|
||||||
if (authenticatorProperties == null) {
|
|
||||||
AuthenticatorConfig config = WindowsAPIUtils.getBSTAuthenticatorConfig();
|
|
||||||
if ((config.getParams() != null) && (!config.getParams().isEmpty())) {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
for (AuthenticatorConfig.Parameter param : config.getParams()) {
|
|
||||||
properties.setProperty(param.getName(), param.getValue());
|
|
||||||
}
|
|
||||||
authenticatorProperties = properties;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return authenticatorProperties;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuth2TokenValidator;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
|
|
||||||
import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO;
|
|
||||||
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the OAuth2 token validation from the same server using OSGi services.
|
|
||||||
*/
|
|
||||||
public class LocalOAuthValidator implements OAuth2TokenValidator {
|
|
||||||
@Override
|
|
||||||
public OAuthValidationResponse validateToken(String accessToken, String resource)
|
|
||||||
throws OAuthTokenValidationException {
|
|
||||||
|
|
||||||
OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO();
|
|
||||||
OAuth2TokenValidationRequestDTO.OAuth2AccessToken oauthToken =
|
|
||||||
validationRequest.new OAuth2AccessToken();
|
|
||||||
oauthToken.setTokenType(OAuthConstants.BEARER_TOKEN_TYPE);
|
|
||||||
oauthToken.setIdentifier(accessToken);
|
|
||||||
validationRequest.setAccessToken(oauthToken);
|
|
||||||
|
|
||||||
//Set the resource context param. This will be used in scope validation.
|
|
||||||
OAuth2TokenValidationRequestDTO.TokenValidationContextParam
|
|
||||||
resourceContextParam = validationRequest.new TokenValidationContextParam();
|
|
||||||
resourceContextParam.setKey(OAuthConstants.RESOURCE_KEY);
|
|
||||||
resourceContextParam.setValue(resource);
|
|
||||||
|
|
||||||
OAuth2TokenValidationRequestDTO.TokenValidationContextParam[]
|
|
||||||
tokenValidationContextParams =
|
|
||||||
new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1];
|
|
||||||
tokenValidationContextParams[0] = resourceContextParam;
|
|
||||||
validationRequest.setContext(tokenValidationContextParams);
|
|
||||||
|
|
||||||
org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO tokenValidationResponse =
|
|
||||||
WindowsAPIUtils.getOAuth2TokenValidationService().findOAuthConsumerIfTokenIsValid(
|
|
||||||
validationRequest).getAccessTokenValidationResponse();
|
|
||||||
boolean isValid = tokenValidationResponse.isValid();
|
|
||||||
String username;
|
|
||||||
String tenantDomain;
|
|
||||||
if (isValid) {
|
|
||||||
username = MultitenantUtils.getTenantAwareUsername(
|
|
||||||
tokenValidationResponse.getAuthorizedUser());
|
|
||||||
tenantDomain =
|
|
||||||
MultitenantUtils.getTenantDomain(tokenValidationResponse.getAuthorizedUser());
|
|
||||||
} else {
|
|
||||||
OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse();
|
|
||||||
oAuthValidationResponse.setErrorMsg(tokenValidationResponse.getErrorMsg());
|
|
||||||
return oAuthValidationResponse;
|
|
||||||
}
|
|
||||||
return new OAuthValidationResponse(username, tenantDomain, isValid);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.apache.commons.pool.impl.GenericObjectPool;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuth2TokenValidator;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthTokenValidationStubFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_TokenValidationContextParam;
|
|
||||||
import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO;
|
|
||||||
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the OAuth2 token validation from remote IS servers using remote OAuthValidation service-stub.
|
|
||||||
*/
|
|
||||||
public class RemoteOAuthValidator implements OAuth2TokenValidator {
|
|
||||||
|
|
||||||
private GenericObjectPool stubs;
|
|
||||||
private static final Log log = LogFactory.getLog(
|
|
||||||
org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.RemoteOAuthValidator.class);
|
|
||||||
|
|
||||||
public RemoteOAuthValidator(String hostURL, String adminUsername, String adminPassword, Properties properties) {
|
|
||||||
this.stubs =
|
|
||||||
new GenericObjectPool(new OAuthTokenValidationStubFactory(
|
|
||||||
hostURL, adminUsername, adminPassword, properties));
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthValidationResponse validateToken(String accessToken,
|
|
||||||
String resource) throws OAuthTokenValidationException {
|
|
||||||
OAuth2TokenValidationServiceStub stub = null;
|
|
||||||
OAuth2TokenValidationResponseDTO validationResponse;
|
|
||||||
try {
|
|
||||||
OAuth2TokenValidationRequestDTO validationRequest = createValidationRequest(accessToken, resource);
|
|
||||||
stub = (OAuth2TokenValidationServiceStub) this.stubs.borrowObject();
|
|
||||||
validationResponse =
|
|
||||||
stub.findOAuthConsumerIfTokenIsValid(validationRequest).getAccessTokenValidationResponse();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw new OAuthTokenValidationException("Remote Exception occurred while invoking the Remote " +
|
|
||||||
"IS server for OAuth2 token validation.", e);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new OAuthTokenValidationException("Error occurred while borrowing an oauth token validation " +
|
|
||||||
"service stub from the pool", e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
this.stubs.returnObject(stub);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("Error occurred while returning the object back to the oauth token validation service " +
|
|
||||||
"stub pool", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (validationResponse == null) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Response returned by the OAuth token validation service is null");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isValid = validationResponse.getValid();
|
|
||||||
String tenantDomain;
|
|
||||||
String username;
|
|
||||||
if (isValid) {
|
|
||||||
username = MultitenantUtils.getTenantAwareUsername(validationResponse.getAuthorizedUser());
|
|
||||||
tenantDomain = MultitenantUtils.getTenantDomain(validationResponse.getAuthorizedUser());
|
|
||||||
} else {
|
|
||||||
OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse();
|
|
||||||
oAuthValidationResponse.setErrorMsg(validationResponse.getErrorMsg());
|
|
||||||
return oAuthValidationResponse;
|
|
||||||
}
|
|
||||||
return new OAuthValidationResponse(username, tenantDomain, isValid);
|
|
||||||
}
|
|
||||||
|
|
||||||
private OAuth2TokenValidationRequestDTO createValidationRequest(String accessToken, String resource) {
|
|
||||||
OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO();
|
|
||||||
OAuth2TokenValidationRequestDTO_OAuth2AccessToken oauthToken =
|
|
||||||
new OAuth2TokenValidationRequestDTO_OAuth2AccessToken();
|
|
||||||
|
|
||||||
oauthToken.setTokenType("bearer");
|
|
||||||
oauthToken.setIdentifier(accessToken);
|
|
||||||
validationRequest.setAccessToken(oauthToken);
|
|
||||||
|
|
||||||
OAuth2TokenValidationRequestDTO_TokenValidationContextParam resourceContextParam =
|
|
||||||
new OAuth2TokenValidationRequestDTO_TokenValidationContextParam();
|
|
||||||
|
|
||||||
resourceContextParam.setKey("resource");
|
|
||||||
resourceContextParam.setValue(resource);
|
|
||||||
|
|
||||||
OAuth2TokenValidationRequestDTO_TokenValidationContextParam[] tokenValidationContextParams =
|
|
||||||
new OAuth2TokenValidationRequestDTO_TokenValidationContextParam[1];
|
|
||||||
|
|
||||||
tokenValidationContextParams[0] = resourceContextParam;
|
|
||||||
validationRequest.setContext(tokenValidationContextParams);
|
|
||||||
|
|
||||||
return validationRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for java CacheEntry
|
|
||||||
*/
|
|
||||||
public class CacheEntry implements Serializable {
|
|
||||||
private String deviceID;
|
|
||||||
private String username;
|
|
||||||
private String ownership;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 19981017L;
|
|
||||||
|
|
||||||
public String getOwnership() {
|
|
||||||
return ownership;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOwnership(String ownership) {
|
|
||||||
this.ownership = ownership;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceID() {
|
|
||||||
return deviceID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceID(String deviceID) {
|
|
||||||
this.deviceID = deviceID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for get device IDS.
|
|
||||||
*/
|
|
||||||
public class Device {
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
public String getID() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setID(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ErrorDTO {
|
|
||||||
|
|
||||||
private Long code = null;
|
|
||||||
private String message = null;
|
|
||||||
private String description = null;
|
|
||||||
|
|
||||||
public void setMoreInfo(String moreInfo) {
|
|
||||||
this.moreInfo = moreInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(Long code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setError(List<ErrorDTO> error) {
|
|
||||||
this.error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String moreInfo = null;
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMoreInfo() {
|
|
||||||
return moreInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ErrorDTO> getError() {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append("class ErrorDTO {\n");
|
|
||||||
stringBuilder.append(" code: ").append(code).append("\n");
|
|
||||||
stringBuilder.append(" message: ").append(message).append("\n");
|
|
||||||
stringBuilder.append(" description: ").append(description).append("\n");
|
|
||||||
stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n");
|
|
||||||
stringBuilder.append(" error: ").append(error).append("\n");
|
|
||||||
stringBuilder.append("}\n");
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ErrorDTO> error = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
|
||||||
public class ErrorListItem {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private String code = null;
|
|
||||||
@NotNull
|
|
||||||
private String message = null;
|
|
||||||
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
@JsonProperty("code")
|
|
||||||
public String getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
public void setCode(String code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorListItem() {}
|
|
||||||
|
|
||||||
public ErrorListItem(String code, String msg) {
|
|
||||||
this.code = code;
|
|
||||||
this.message = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description about individual errors occurred
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = true, value = "Description about individual errors occurred")
|
|
||||||
@JsonProperty("message")
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("errorItem {\n");
|
|
||||||
|
|
||||||
sb.append(" code: ").append(code).append("\n");
|
|
||||||
sb.append(" message: ").append(message).append("\n");
|
|
||||||
sb.append("}\n");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,167 +0,0 @@
|
|||||||
package org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ErrorResponse {
|
|
||||||
private Long code = null;
|
|
||||||
private String message = null;
|
|
||||||
private String description = null;
|
|
||||||
private String moreInfo = null;
|
|
||||||
private List<ErrorListItem> errorItems = new ArrayList<>();
|
|
||||||
|
|
||||||
@JsonProperty(value = "code")
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
public Long getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(Long code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty(value = "message")
|
|
||||||
@ApiModelProperty(required = true, value = "ErrorResponse message.")
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty(value = "description")
|
|
||||||
@ApiModelProperty(value = "A detail description about the error message.")
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonProperty(value = "moreInfo")
|
|
||||||
@ApiModelProperty(value = "Preferably an url with more details about the error.")
|
|
||||||
public String getMoreInfo() {
|
|
||||||
return moreInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMoreInfo(String moreInfo) {
|
|
||||||
this.moreInfo = moreInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addErrorListItem(ErrorListItem item) {
|
|
||||||
this.errorItems.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If there are more than one error list them out. \nFor example, list out validation errors by each field.
|
|
||||||
*/
|
|
||||||
@JsonProperty(value = "errorItems")
|
|
||||||
@ApiModelProperty(value = "If there are more than one error list them out. \n" +
|
|
||||||
"For example, list out validation errors by each field.")
|
|
||||||
public List<ErrorListItem> getErrorItems() {
|
|
||||||
return errorItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorItems(List<ErrorListItem> error) {
|
|
||||||
this.errorItems = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
|
||||||
// sb.append("{");
|
|
||||||
// boolean cont = false;
|
|
||||||
// if (code != null) {
|
|
||||||
// cont = true;
|
|
||||||
// sb.append(" \"code\": ").append(code);
|
|
||||||
// }
|
|
||||||
// if (message != null) {
|
|
||||||
// if (cont) {
|
|
||||||
// sb.append(",");
|
|
||||||
// }
|
|
||||||
// cont = true;
|
|
||||||
// sb.append(" \"message\": \"").append(message).append("\"");
|
|
||||||
// }
|
|
||||||
// if (description != null) {
|
|
||||||
// if (cont) {
|
|
||||||
// sb.append(",");
|
|
||||||
// }
|
|
||||||
// cont = true;
|
|
||||||
// sb.append(" \"description\": ").append(description).append("\"");
|
|
||||||
// }
|
|
||||||
// if (moreInfo != null) {
|
|
||||||
// if (cont) {
|
|
||||||
// sb.append(",");
|
|
||||||
// }
|
|
||||||
// cont = true;
|
|
||||||
// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\"");
|
|
||||||
// }
|
|
||||||
// if (error != null && error.size() > 0) {
|
|
||||||
// if (cont) {
|
|
||||||
// sb.append(",");
|
|
||||||
// }
|
|
||||||
// sb.append(" \"errorItems\": ").append(error);
|
|
||||||
// }
|
|
||||||
// sb.append("}");
|
|
||||||
// return sb.toString();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ErrorResponseBuilder {
|
|
||||||
|
|
||||||
private Long code = null;
|
|
||||||
private String message = null;
|
|
||||||
private String description = null;
|
|
||||||
private String moreInfo = null;
|
|
||||||
private List<ErrorListItem> error;
|
|
||||||
|
|
||||||
|
|
||||||
public ErrorResponseBuilder() {
|
|
||||||
this.error = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseBuilder setCode(long code) {
|
|
||||||
this.code = code;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseBuilder setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseBuilder setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseBuilder setMoreInfo(String moreInfo) {
|
|
||||||
this.moreInfo = moreInfo;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseBuilder addErrorItem(String code, String msg) {
|
|
||||||
ErrorListItem item = new ErrorListItem();
|
|
||||||
item.setCode(code);
|
|
||||||
item.setMessage(msg);
|
|
||||||
this.error.add(item);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponse build() {
|
|
||||||
ErrorResponse errorResponse = new ErrorResponse();
|
|
||||||
errorResponse.setCode(code);
|
|
||||||
errorResponse.setMessage(message);
|
|
||||||
errorResponse.setErrorItems(error);
|
|
||||||
errorResponse.setDescription(description);
|
|
||||||
errorResponse.setMoreInfo(moreInfo);
|
|
||||||
return errorResponse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.BasicOperation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for set basic operations.
|
|
||||||
*/
|
|
||||||
public class OperationRequest {
|
|
||||||
|
|
||||||
private List<Device> deviceList;
|
|
||||||
private BasicOperation basicOperation;
|
|
||||||
|
|
||||||
public BasicOperation getBasicOperation() {
|
|
||||||
return basicOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBasicOperation(BasicOperation basicOperation) {
|
|
||||||
this.basicOperation = basicOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Device> getDeviceList() {
|
|
||||||
return deviceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceList(List<Device> deviceList) {
|
|
||||||
this.deviceList = deviceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for challenge token
|
|
||||||
*/
|
|
||||||
public class Token {
|
|
||||||
private String challengeToken;
|
|
||||||
|
|
||||||
public String getChallengeToken() {
|
|
||||||
return challengeToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChallengeToken(String challengeToken) {
|
|
||||||
this.challengeToken = challengeToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception class for authentication failures in windows device enrollment.
|
|
||||||
*/
|
|
||||||
public class AuthenticationException extends Exception {
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public AuthenticationException(String message) {
|
|
||||||
super(message);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationException(String message, Exception nestedEx) {
|
|
||||||
super(message, nestedEx);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
|
|
||||||
|
|
||||||
import javax.ws.rs.WebApplicationException;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception class for bad request failures
|
|
||||||
*/
|
|
||||||
public class BadRequestException extends WebApplicationException {
|
|
||||||
|
|
||||||
public BadRequestException(ErrorResponse error) {
|
|
||||||
super(Response.status(Response.Status.BAD_REQUEST).entity(error).build());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception class for Certificate generation failures in WSTEP stage.
|
|
||||||
*/
|
|
||||||
public class CertificateGenerationException extends Exception {
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public CertificateGenerationException(String message) {
|
|
||||||
super(message);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CertificateGenerationException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CertificateGenerationException(String message, Exception nestedEx) {
|
|
||||||
super(message, nestedEx);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CertificateGenerationException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CertificateGenerationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception class for file reading/writing failures.
|
|
||||||
*/
|
|
||||||
public class FileOperationException extends Exception {
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public FileOperationException(String message) {
|
|
||||||
super(message);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileOperationException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileOperationException(String message, Exception nestedEx) {
|
|
||||||
super(message, nestedEx);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileOperationException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileOperationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception class for Keystore generation failures.
|
|
||||||
*/
|
|
||||||
public class KeyStoreGenerationException extends Exception {
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public KeyStoreGenerationException(String message) {
|
|
||||||
super(message);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyStoreGenerationException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyStoreGenerationException(String message, Exception nestedEx) {
|
|
||||||
super(message, nestedEx);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyStoreGenerationException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyStoreGenerationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MDMAPIUtils class provides utility function which are used by CDM REST-API classes.
|
|
||||||
*/
|
|
||||||
public class MDMAPIException extends Exception {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 7950151650447893900L;
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDMAPIException(String msg, Exception e) {
|
|
||||||
super(msg, e);
|
|
||||||
setErrorMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDMAPIException(String msg, Throwable cause) {
|
|
||||||
super(msg, cause);
|
|
||||||
setErrorMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDMAPIException(String msg) {
|
|
||||||
super(msg);
|
|
||||||
setErrorMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDMAPIException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDMAPIException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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 org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom exception to be thrown inside OAuthTokenValidation related functionality.
|
|
||||||
*/
|
|
||||||
public class OAuthTokenValidationException extends Exception {
|
|
||||||
private static final long serialVersionUID = -3151279311929070297L;
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthTokenValidationException(String msg, Exception nestedEx) {
|
|
||||||
super(msg, nestedEx);
|
|
||||||
setErrorMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthTokenValidationException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
setErrorMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthTokenValidationException(String msg) {
|
|
||||||
super(msg);
|
|
||||||
setErrorMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthTokenValidationException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public OAuthTokenValidationException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue