diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js index 771db411f2e..22da9284955 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js @@ -40,7 +40,7 @@ var handlers = function () { "as input - setupTokenPairByPasswordGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); 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 " + @@ -84,7 +84,7 @@ var handlers = function () { "as input - setupTokenPairBySamlGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); 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 " + @@ -129,7 +129,7 @@ var handlers = function () { "as input - setupTokenPairBySamlGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); 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 " + @@ -224,44 +224,44 @@ var handlers = function () { } }; - privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } else { - if (devicemgtProps["gatewayEnabled"]) { - var tenantBasedWebSocketClientAppCredentials - = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); - if (!tenantBasedWebSocketClientAppCredentials) { - 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } else { - var encodedTenantBasedWebSocketClientAppCredentials = - tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + - tenantBasedWebSocketClientAppCredentials["clientSecret"]); - // setting up encoded tenant based client credentials to session context. - session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], - encodedTenantBasedWebSocketClientAppCredentials); - } - } 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } - var encodedTenantBasedWebSocketClientAppCredentials = - tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + - dynamicClientAppCredentials["clientSecret"]); - // setting up encoded tenant based client credentials to session context. - session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], - encodedTenantBasedWebSocketClientAppCredentials); - } +// privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } else { +// if (devicemgtProps["gatewayEnabled"]) { +// var tenantBasedWebSocketClientAppCredentials +// = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); +// if (!tenantBasedWebSocketClientAppCredentials) { +// 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } else { +// var encodedTenantBasedWebSocketClientAppCredentials = +// tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + +// tenantBasedWebSocketClientAppCredentials["clientSecret"]); +// // setting up encoded tenant based client credentials to session context. +// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], +// encodedTenantBasedWebSocketClientAppCredentials); +// } +// } 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 - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } +// var encodedTenantBasedWebSocketClientAppCredentials = +// tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + +// dynamicClientAppCredentials["clientSecret"]); +// // setting up encoded tenant based client credentials to session context. +// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], +// encodedTenantBasedWebSocketClientAppCredentials); +// } - } - }; +// } +// }; return publicMethods; -}(); \ No newline at end of file +}();