diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
index 1fb4ef320..0d0375dc0 100644
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
@@ -73,7 +73,6 @@
{{#zone "device-details-tab-injected"}}
@@ -116,11 +111,6 @@
-
-
-
{{js "js/device-detail.js"}}
{{js "js/load-map.js"}}
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json
index 3973c7649..6575367e5 100755
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json
@@ -6,15 +6,11 @@
"adminService":"%https.ip%",
"oauthProvider": {
"appRegistration": {
- "appType": "webapp",
- "clientName": "windows-web-agent",
- "owner": "admin@carbon.super",
- "dynamicClientAppRegistrationServiceURL": "%https.ip%/dynamic-client-web/register",
- "apiManagerClientAppRegistrationServiceURL": "%https.ip%/api-application-registration/register/tenants",
- "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer",
- "tokenScope": "admin",
- "callbackUrl": "%https.ip%/api/device-mgt/v1.0",
- "samlGrantTypeName": "urn:ietf:params:oauth:grant-type:saml2-bearer"
+ "apiManagerClientAppRegistrationServiceURL": "%https.ip%/api-application-registration/register",
+ "applicationName":"windows-web-agent",
+ "tags":["windows"],
+ "isAllowedToAllDomains":false,
+ "isMappingAnExistingOAuthApp":false
},
"tokenServiceURL": "%https.ip%/oauth2/token"
},
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js
index e6d4a41df..81932f77a 100755
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js
@@ -41,25 +41,24 @@ var utils = function () {
return String(Base64.decodeBase64(String(payload).getBytes()));
};
- publicMethods["getDynamicClientAppCredentials"] = function () {
+ publicMethods["getDynamicClientAppCredentials"] = function (username, password) {
// setting up dynamic client application properties
var dcAppProperties = {
- "applicationType": deviceMgtProps["oauthProvider"]["appRegistration"]["appType"],
- "clientName": deviceMgtProps["oauthProvider"]["appRegistration"]["clientName"],
- "owner": deviceMgtProps["oauthProvider"]["appRegistration"]["owner"],
- "tokenScope": deviceMgtProps["oauthProvider"]["appRegistration"]["tokenScope"],
- "grantType": deviceMgtProps["oauthProvider"]["appRegistration"]["grantType"],
- "callbackUrl": deviceMgtProps["oauthProvider"]["appRegistration"]["callbackUrl"],
- "saasApp" : true
+ "applicationName": deviceMgtProps["oauthProvider"]["appRegistration"]["applicationName"],
+ "tags": deviceMgtProps["oauthProvider"]["appRegistration"]["tags"],
+ "isAllowedToAllDomains": deviceMgtProps["oauthProvider"]["appRegistration"]["isAllowedToAllDomains"],
+ "isMappingAnExistingOAuthApp": deviceMgtProps["oauthProvider"]["appRegistration"]["isMappingAnExistingOAuthApp"]
};
// calling dynamic client app registration service endpoint
var requestURL = deviceMgtProps["oauthProvider"]["appRegistration"]
["dynamicClientAppRegistrationServiceURL"];
var requestPayload = dcAppProperties;
+ var encodedBasicOauth = publicMethods.encode(username + ":" + password);
var xhr = new XMLHttpRequest();
xhr.open("POST", requestURL, false);
xhr.setRequestHeader("Content-Type", "application/json");
+ xhr.setRequestHeader("Authorization","Basic "+ encodedBasicOauth);
xhr.send(stringify(requestPayload));
var dynamicClientAppCredentials = {};
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js
index f18f4c235..5dc694592 100755
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handlers.js
@@ -38,7 +38,7 @@ var handlers = function () {
"password grant type. Either username of logged in user, password or both are missing " +
"as input - setupTokenPairByPasswordGrantType(x, y)");
} else {
- privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
+ privateMethods.setUpEncodedTenantBasedClientAppCredentials(username, password);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " +
@@ -130,13 +130,13 @@ var handlers = function () {
}
};
- privateMethods["setUpEncodedTenantBasedClientAppCredentials"] = function (username) {
+ privateMethods["setUpEncodedTenantBasedClientAppCredentials"] = function (username, password) {
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)");
} else {
- var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
+ var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(username, password);
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 " +