fixing windows enrollment flow

revert-dabc3590
Hasunie 8 years ago
parent 0fd317d027
commit 35ba0b2a9b

@ -28,17 +28,17 @@
<baseDirectory>${basedir}/src</baseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory>
<outputDirectory>/devicemgt</outputDirectory>
<directory>${basedir}/src/main/resources/jaggeryapps/windows-web-agent</directory>
<outputDirectory>/windows-web-agent</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory>
<outputDirectory>/windows-web-agent</outputDirectory>
<directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory>
<outputDirectory>/devicemgt</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/windows-web-agent</directory>
<directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory>
<outputDirectory>/windows-web-agent</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>

@ -312,7 +312,7 @@ deviceModule = function () {
var url;
var license;
if (deviceType == "windows") {
url = devicemgtProps["httpURL"] + "/mdm-windows-agent/services/device/license";
url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/services/configuration/license";
} else if (deviceType == "ios") {
url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/";
}

@ -57,24 +57,24 @@ if (platform != "Windows Phone") {
}
};
serviceInvokers.XMLHttp.post(
authUrl,
stringify(payload),
function (restAPIResponse) {
var status = restAPIResponse["status"];
if (status == 200) {
session.put("authenticatedUser", username);
session.put("windowsBinaryToken", parse(xmlHttpRequest["responseText"]).UserToken);
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/license-agent");
} else if (status == 403) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=auth-failed");
} else if (status == 409) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?" +
"error=auth-failed&message=Provided Workplace email does not match with username. Please check.");
} else {
// one visible possibility would be server sending 500
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=unexpected");
authUrl,
stringify(payload),
function (restAPIResponse) {
var status = restAPIResponse["status"];
if (status == 200) {
session.put("authenticatedUser", username);
session.put("windowsBinaryToken", parse(restAPIResponse["responseText"]).UserToken);
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/license-agent");
} else if (status == 403) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=auth-failed");
} else if (status == 409) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?" +
"error=auth-failed&message=Provided Workplace email does not match with username. Please check.");
} else {
// one visible possibility would be server sending 500
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=unexpected");
}
}
}
);
}
}

@ -36,10 +36,10 @@ if (platform != "Windows Phone") {
if (!authenticatedUser) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request");
} else {
var enrollmentUtils = require("/modules/enrollments/util/utils.js")["methods"];
var Handlebars = require("/lib/handlebars-v2.0.0.js")["Handlebars"];
var enrollmentUtils = require("/app/modules/enrollments/util/utils.js")["methods"];
var Handlebars = require("/lib/modules/handlebars/handlebars-v2.0.0.js")["Handlebars"];
var template = Handlebars.compile(enrollmentUtils.
getResource("/modules/enrollments/windows/config/workplace-switch-request-template.hbs"));
getResource("/app/modules/enrollments/windows/config/workplace-switch-request-template.hbs"));
var windowsWorkplaceAppID = session.get("windowsWorkplaceAppID");
var windowsBinaryToken = session.get("windowsBinaryToken");

@ -133,35 +133,44 @@ var handlers = function () {
privateMethods["setUpEncodedTenantBasedClientAppCredentials"] = function (username) {
if (!username) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context. No username of logged in user is found as " +
"input - setUpEncodedTenantBasedClientAppCredentials(x)");
"client credentials to session context. No username of logged in user is found as " +
"input - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
if (!dynamicClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
"client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials);
if (!jwtToken) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
if (devicemgtProps["apimgt-gateway"]) {
var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials);
if (!jwtToken) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context as the server is unable to obtain " +
"a jwt token - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
var tenantBasedClientAppCredentials = tokenUtil.
getTenantBasedClientAppCredentials(username, jwtToken);
if (!tenantBasedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
"based client credentials to session context as the server is unable " +
"to obtain such credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
"a jwt token - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
var encodedTenantBasedClientAppCredentials =
tokenUtil.encode(tenantBasedClientAppCredentials["clientId"] + ":" +
var tenantBasedClientAppCredentials = tokenUtil.
getTenantBasedClientAppCredentials(username, jwtToken);
if (!tenantBasedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
"based client credentials to session context as the server is unable " +
"to obtain such credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
} else {
var encodedTenantBasedClientAppCredentials =
tokenUtil.encode(tenantBasedClientAppCredentials["clientId"] + ":" +
tenantBasedClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"],
encodedTenantBasedClientAppCredentials);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"],
encodedTenantBasedClientAppCredentials);
}
}
} else {
var encodedTenantBasedClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"],
encodedTenantBasedClientAppCredentials);
}
}
}

@ -65,33 +65,33 @@
}
],
"securityConstraints": [
{
"securityConstraint": {
"webResourceCollection": {
"name": "WINDOWS-WEB-AGENT",
"urlPatterns": [
"/*"
]
},
"userDataConstraint": {
"transportGuarantee": "CONFIDENTIAL"
}
}
},
{
"securityConstraint": {
"webResourceCollection": {
"name": "WINDOWS-WEB-AGENT-http",
"urlPatterns": [
"/public/*",
"/enrollments/windows/*",
"/enrollment/windows/*"
]
},
"userDataConstraint": {
"transportGuarantee": "NONE"
}
}
{
"securityConstraint": {
"webResourceCollection": {
"name": "WINDOWS-WEB-AGENT",
"urlPatterns": [
"/*"
]
},
"userDataConstraint": {
"transportGuarantee": "CONFIDENTIAL"
}
}
},
{
"securityConstraint": {
"webResourceCollection": {
"name": "WINDOWS-WEB-AGENT-http",
"urlPatterns": [
"/public/*",
"/enrollments/windows/*",
"/enrollment/windows/*"
]
},
"userDataConstraint": {
"transportGuarantee": "NONE"
}
}
}
]
}

@ -30,7 +30,7 @@
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WindowsDM_DB;DB_CLOSE_ON_EXIT=FALSE
<url>jdbc:h2:repository/database/WSO2MobileWindows_DB;DB_CLOSE_ON_EXIT=FALSE
</url>
<username>wso2carbon</username>
<password>wso2carbon</password>

@ -19,56 +19,96 @@
-->
<DeviceTypeConfiguration name="windows">
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
<DeviceDetails table-id="WIN_DEVICE"/>
<ProvisioningConfig>
<SharedWithAllTenants>false</SharedWithAllTenants>
</ProvisioningConfig>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
<DataSource>
<jndiConfig>
<name>jdbc/MobileWindowsDM_DS</name>
</jndiConfig>
<tableConfig>
<Table name="WIN_DEVICE">
<PrimaryKey>DEVICE_ID</PrimaryKey>
<Attributes>
<Attribute>DEVICE_ID</Attribute>
<Attribute>CHANNEL_URI</Attribute>
<Attribute>DEVICE_INFO</Attribute>
<Attribute>IMEI</Attribute>
<Attribute>IMSI</Attribute>
<Attribute>OS_VERSION</Attribute>
<Attribute>DEVICE_MODEL</Attribute>
<Attribute>VENDOR</Attribute>
<Attribute>LATITUDE</Attribute>
<Attribute>LONGITUDE</Attribute>
<Attribute>SERIAL</Attribute>
<Attribute>MAC_ADDRESS</Attribute>
<Attribute>DEVICE_NAME</Attribute>
<Attribute>OS_BUILD_DATE</Attribute>
</Attributes>
</Table>
</tableConfig>
</DataSource>
<ProvisioningConfig>
<SharedWithAllTenants>false</SharedWithAllTenants>
</ProvisioningConfig>
<Features>
<Feature code="abc">
<Name>abc</Name>
<Description>this is a feature</Description>
<Operation context="/bulb/{state}" method="PUT">
<QueryParameters>
<Parameter>deviceId</Parameter>
</QueryParameters>
<FormParameters>
<Parameter>test</Parameter>
</FormParameters>
</Operation>
</Feature>
</Features>
<DataSource>
<jndiConfig>
<name>jdbc/MobileWindowsDM_DS</name>
</jndiConfig>
<tableConfig>
<Table name="WIN_DEVICE">
<PrimaryKey>DEVICE_ID</PrimaryKey>
<Attributes>
<Attribute>CHANNEL_URI</Attribute>
<Attribute>DEVICE_INFO</Attribute>
<Attribute>IMEI</Attribute>
<Attribute>IMSI</Attribute>
<Attribute>OS_VERSION</Attribute>
<Attribute>DEVICE_MODEL</Attribute>
<Attribute>VENDOR</Attribute>
<Attribute>LATITUDE</Attribute>
<Attribute>LONGITUDE</Attribute>
<Attribute>SERIAL</Attribute>
<Attribute>MAC_ADDRESS</Attribute>
<Attribute>DEVICE_NAME</Attribute>
</Attributes>
</Table>
</tableConfig>
</DataSource>
<Features>
<Feature code="DEVICE_LOCK">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/lock-devices" method="POST">
</Operation>
</Feature>
<Feature code="DISENROLL">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/disenroll-devices" method="POST">
</Operation>
</Feature>
<Feature code="WIPE_DATA">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/wipe-devices" method="POST">
</Operation>
</Feature>
<Feature code="DEVICE_RING">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/ring-devices" method="POST">
</Operation>
</Feature>
<Feature code="LOCK_RESET">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/lock-reset-devices" method="POST">
</Operation>
</Feature>
<Feature code="PASSCODE_POLICY">
<Name>Password Policy</Name>
<Description>Set passcode policy</Description>
<Operation context="" method="POST">
</Operation>
</Feature>
<Feature code="CAMERA">
<Name>Camera Enable/Disable</Name>
<Description>Enable/Disable camera</Description>
<Operation context="" method="POST">
</Operation>
</Feature>
<Feature code="ENCRYPT_STORAGE">
<Name>Encrypt Storage</Name>
<Description>Encrypt the device storage</Description>
<Operation context="" method="POST">
</Operation>
</Feature>
</Features>
<DeviceAuthorizationConfig>
<authorizationRequired>false</authorizationRequired>
</DeviceAuthorizationConfig>
</DeviceTypeConfiguration>

@ -18,7 +18,12 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../dep
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.qr-modal);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/windows);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/WSO2MobileWindows_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../.

Loading…
Cancel
Save