From 4b39a877ad7cdd31b5732840bfc086e51b682ed4 Mon Sep 17 00:00:00 2001 From: dilanua Date: Thu, 28 Jul 2016 13:49:27 +0530 Subject: [PATCH] Updating oauth token handlers --- .../devicemgt/api/data-tables-invoker-api.jag | 2 +- .../jaggeryapps/devicemgt/api/device-api.jag | 2 +- .../jaggeryapps/devicemgt/api/group-api.jag | 2 +- .../jaggeryapps/devicemgt/api/invoker-api.jag | 2 +- .../devicemgt/api/operation-api.jag | 2 +- .../jaggeryapps/devicemgt/api/token.jag | 2 +- .../jaggeryapps/devicemgt/api/user-api.jag | 2 +- .../devicemgt/app/modules/api-wrapper-util.js | 96 +++++++++++-------- .../app/modules/backend-service-invoker.js | 10 +- .../devicemgt/app/modules/device.js | 2 +- .../devicemgt/app/modules/group.js | 2 +- .../devicemgt/app/modules/login.js | 2 +- .../devicemgt/app/modules/operation.js | 2 +- .../devicemgt/app/modules/policy.js | 2 +- .../jaggeryapps/devicemgt/app/modules/user.js | 2 +- 15 files changed, 78 insertions(+), 54 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag index 16aa1a7ed91..e52746e9dfe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag @@ -23,7 +23,7 @@ var uri = request.getRequestURI(); var uriMatcher = new URIMatcher(String(uri)); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"]; +var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; function appendQueryParam (url, queryParam , value) { if (url.indexOf("?") > 0) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag index 8b1d42b3939..1a163d76e45 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/device-api.jag @@ -26,7 +26,7 @@ var deviceModule = require("/app/modules/device.js").deviceModule; var utility = require("/app/modules/utility.js").utility; var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var userModule = require("/app/modules/user.js").userModule; -var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; +var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var user = session.get(constants.USER_SESSION_KEY); var result; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag index d36efad7e5f..d5f9bb26289 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/group-api.jag @@ -24,7 +24,7 @@ var log = new Log("api/device-api.jag"); var constants = require("/app/modules/constants.js"); var utility = require("/app/modules/utility.js").utility; var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; +var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var user = session.get(constants.USER_SESSION_KEY); var result; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag index fbbaad8d909..6fa133523e2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/invoker-api.jag @@ -24,7 +24,7 @@ var uriMatcher = new URIMatcher(String(uri)); var constants = require("/app/modules/constants.js"); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; -var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"]; +var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; if (uriMatcher.match("/{context}/api/invoker/execute/")) { var restAPIRequestDetails = request.getContent(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag index b961df21a6f..46b4595b663 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag @@ -22,7 +22,7 @@ var uriMatcher = new URIMatcher(String(uri)); var log = new Log("api/operation-api.jag"); -var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"]; +var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; if (uriMatcher.match("/{context}/api/operation/paginate")) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/token.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/token.jag index b3302a66596..45210346bb1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/token.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/token.jag @@ -21,7 +21,7 @@ @Deprecated - new */ -// var apiWrapperUtil = require("/app/modules/api-wrapper-util.js").apiWrapperUtil; +// var apiWrapperUtil = require("/app/modules/api-wrapper-util.js")["handlers"]; // var tokenCookie = apiWrapperUtil.refreshToken(); // print(tokenCookie); %> \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag index d472fad0515..cab3d3a32fd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag @@ -27,7 +27,7 @@ var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var userModule = require("/app/modules/user.js").userModule; var deviceModule = require("/app/modules/device.js").deviceModule; var utility = require("/app/modules/utility.js").utility; -var apiWrapperUtil = require("/app/modules/api-wrapper-util.js").apiWrapperUtil; +var apiWrapperUtil = require("/app/modules/api-wrapper-util.js")["handlers"]; var util = require("/app/modules/util.js").util; var responseProcessor = require('utils').response; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/api-wrapper-util.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/api-wrapper-util.js index 6c7108e3b3c..02df5fb3a1d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/api-wrapper-util.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/api-wrapper-util.js @@ -16,8 +16,15 @@ * under the License. */ -var apiWrapperUtil = function () { - var log = new Log("/app/modules/api-wrapper-util.js"); +/** + * ---------------------------------------------------------------------------- + * Following module includes invokers + * at Jaggery Layer for calling Backend Services, protected by OAuth Tokens. + * These Services include both REST and SOAP Services. + * ---------------------------------------------------------------------------- + */ +var handlers = function () { + var log = new Log("/app/modules/token-handlers.js"); var tokenUtil = require("/app/modules/util.js")["util"]; var constants = require("/app/modules/constants.js"); @@ -28,23 +35,27 @@ var apiWrapperUtil = function () { privateMethods.setUpEncodedTenantBasedClientCredentials = function (username) { if (!username) { - log.error("Could not set up encoded tenant based client credentials " + - "to session context. No username is found as input."); + throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant based " + + "client credentials to session context. No username is found as " + + "input - setUpEncodedTenantBasedClientCredentials(x)"); } else { var dynamicClientCredentials = tokenUtil.getDynamicClientCredentials(); if (!dynamicClientCredentials) { - log.error("Could not set up encoded tenant based client credentials " + - "to session context as the server is unable to obtain dynamic client credentials."); + throw new Error("{/app/modules/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 - setUpEncodedTenantBasedClientCredentials(x)"); } else { var jwtToken = tokenUtil.getTokenWithJWTGrantType(dynamicClientCredentials); if (!jwtToken) { - log.error("Could not set up encoded tenant based client credentials " + - "to session context as the server is unable to obtain a jwt token."); + throw new Error("{/app/modules/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 - setUpEncodedTenantBasedClientCredentials(x)"); } else { var tenantBasedClientCredentials = tokenUtil.getTenantBasedAppCredentials(username, jwtToken); if (!tenantBasedClientCredentials) { - log.error("Could not set up encoded tenant based client credentials " + - "to session context as the server is unable to obtain such credentials."); + throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant " + + "based client credentials to session context as the server is unable " + + "to obtain such credentials - setUpEncodedTenantBasedClientCredentials(x)"); } else { var encodedTenantBasedClientCredentials = tokenUtil.encode(tenantBasedClientCredentials["clientId"] + ":" + @@ -57,34 +68,18 @@ var apiWrapperUtil = function () { } }; - publicMethods.refreshToken = function () { - var accessTokenPair = parse(session.get(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"])); - // accessTokenPair includes current access token as well as current refresh token - var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); - if (!accessTokenPair || !encodedClientCredentials) { - log.error("Error in refreshing tokens. Either the access token pair, " + - "encoded client credentials or both input are not found under session context."); - } else { - var newAccessTokenPair = tokenUtil.refreshToken(accessTokenPair, encodedClientCredentials); - if (!newAccessTokenPair) { - log.error("Error in refreshing tokens. Unable to update " + - "session context with new access token pair."); - } else { - session.put(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"], stringify(newAccessTokenPair)); - } - } - }; - publicMethods.setupAccessTokenPairByPasswordGrantType = function (username, password) { if (!username || !password) { - log.error("Could not set up access token pair by password grant type. " + - "Either username, password or both are missing as input."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + "password grant type. Either username, password or both are missing as " + + "input - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientCredentials(username); var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); if (!encodedClientCredentials) { - log.error("Could not set up access token pair by password grant type. " + - "Encoded client credentials are missing."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + "password grant type. Encoded client credentials are " + + "missing - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { var accessTokenPair; // accessTokenPair will include current access token as well as current refresh token @@ -97,7 +92,9 @@ var apiWrapperUtil = function () { getTokenWithPasswordGrantType(username, encodeURIComponent(password), encodedClientCredentials, stringOfScopes); if (!accessTokenPair) { - log.error("Could not set up access token pair by password grant type. Error in token retrieval."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access " + + "token pair by password grant type. Error in token " + + "retrieval - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { // setting up access token pair into session context as a string session.put(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"], stringify(accessTokenPair)); @@ -108,21 +105,25 @@ var apiWrapperUtil = function () { publicMethods.setupAccessTokenPairBySamlGrantType = function (username, samlToken) { if (!username || !samlToken) { - log.error("Could not set up access token pair by saml grant type. " + - "Either username, samlToken or both are missing as input."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + "saml grant type. Either username, samlToken or both are missing as " + + "input - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientCredentials(username); var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); if (!encodedClientCredentials) { - log.error("Could not set up access token pair by saml grant type. " + - "Encoded client credentials are missing."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair " + + "by saml grant type. Encoded client credentials are " + + "missing - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { var accessTokenPair; // accessTokenPair will include current access token as well as current refresh token accessTokenPair = tokenUtil. getTokenWithSAMLGrantType(samlToken, encodedClientCredentials, "PRODUCTION"); if (!accessTokenPair) { - log.error("Could not set up access token pair by password grant type. Error in token retrieval."); + throw new Error("{/app/modules/token-handlers.js} Could not set up access token " + + "pair by password grant type. Error in token " + + "retrieval - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { // setting up access token pair into session context as a string session.put(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"], stringify(accessTokenPair)); @@ -131,5 +132,24 @@ var apiWrapperUtil = function () { } }; + publicMethods.refreshToken = function () { + var accessTokenPair = parse(session.get(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"])); + // accessTokenPair includes current access token as well as current refresh token + var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); + if (!accessTokenPair || !encodedClientCredentials) { + throw new Error("{/app/modules/token-handlers.js} Error in refreshing tokens. Either the access " + + "token pair, encoded client credentials or both input are not found under " + + "session context - refreshToken()"); + } else { + var newAccessTokenPair = tokenUtil.refreshToken(accessTokenPair, encodedClientCredentials); + if (!newAccessTokenPair) { + log.error("{/app/modules/token-handlers.js} Error in refreshing tokens. Unable to update " + + "session context with new access token pair - refreshToken()"); + } else { + session.put(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"], stringify(newAccessTokenPair)); + } + } + }; + return publicMethods; }(); \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/backend-service-invoker.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/backend-service-invoker.js index 36c9f8a075a..5fd0277d5d8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/backend-service-invoker.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/backend-service-invoker.js @@ -17,9 +17,13 @@ */ /** - * This backendServiceInvoker contains the wrappers for back end jaggery calls. + * ---------------------------------------------------------------------------- + * Following module includes invokers + * at Jaggery Layer for calling Backend Services, protected by OAuth Tokens. + * These Services include both REST and SOAP Services. + * ---------------------------------------------------------------------------- */ -var backendServiceInvoker = function () { +var invokers = function () { var log = new Log("/app/modules/backend-service-invoker.js"); var publicXMLHTTPInvokers = {}; @@ -34,7 +38,7 @@ var backendServiceInvoker = function () { var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var constants = require("/app/modules/constants.js"); var userModule = require("/app/modules/user.js")["userModule"]; - var tokenUtil = require("/app/modules/api-wrapper-util.js")["apiWrapperUtil"]; + var tokenUtil = require("/app/modules/api-wrapper-util.js")["handlers"]; /** * This method reads the token pair from the session and return the access token. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/device.js index 1cd0c5e445c..464093343d5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/device.js @@ -23,7 +23,7 @@ deviceModule = function () { var utility = require('/app/modules/utility.js').utility; var constants = require('/app/modules/constants.js'); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; + var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var ArrayList = Packages.java.util.ArrayList; var Properties = Packages.java.util.Properties; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/group.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/group.js index da664859b52..61bfe9f4b71 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/group.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/group.js @@ -24,7 +24,7 @@ var groupModule = {}; var constants = require('/app/modules/constants.js'); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; var utility = require("/app/modules/utility.js").utility; - var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; + var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var groupServiceEndpoint = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/groups"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js index eeeb81ba5ef..429a6b9c1cf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js @@ -24,7 +24,7 @@ var onFail; var constants = require("/app/modules/constants.js"); onSuccess = function (context) { var utility = require("/app/modules/utility.js").utility; - var apiWrapperUtil = require("/app/modules/api-wrapper-util.js").apiWrapperUtil; + var apiWrapperUtil = require("/app/modules/api-wrapper-util.js")["handlers"]; if (context.input.samlToken) { apiWrapperUtil.setupAccessTokenPairBySamlGrantType(context.input.username, context.input.samlToken); } else { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/operation.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/operation.js index 447c3868124..981a58f5ce9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/operation.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/operation.js @@ -21,7 +21,7 @@ var operationModule = function () { var utility = require('/app/modules/utility.js').utility; var constants = require('/app/modules/constants.js'); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; + var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"];; var publicMethods = {}; var privateMethods = {}; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/policy.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/policy.js index e4b143dee32..a46ce90b7ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/policy.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/policy.js @@ -26,7 +26,7 @@ policyModule = function () { var constants = require('/app/modules/constants.js'); var utility = require("/app/modules/utility.js")["utility"]; var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker; + var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; var publicMethods = {}; var privateMethods = {}; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js index cea0e38c40f..b2c840aae84 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/user.js @@ -25,7 +25,7 @@ var userModule = function () { var constants = require("/app/modules/constants.js"); var utility = require("/app/modules/utility.js")["utility"]; var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; - var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"]; + var serviceInvokers = require("/app/modules/backend-service-invoker.js")["invokers"]; /* Initializing user manager */ var carbon = require("carbon");