From 032b5d129ab3aa85f1127d0035d06c41f6ce2fc7 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 29 Jul 2016 16:48:20 +0530 Subject: [PATCH] Adding OAUTH module to UI --- .../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/user-api.jag | 4 +-- .../devicemgt/app/modules/device.js | 2 +- .../devicemgt/app/modules/group.js | 2 +- .../devicemgt/app/modules/login.js | 2 +- .../app/modules/{ => oauth}/token-handlers.js | 28 +++++++++---------- .../token-protected-service-invokers.js | 4 +-- .../devicemgt/app/modules/{ => oauth}/util.js | 28 +++++++++---------- .../devicemgt/app/modules/operation.js | 2 +- .../devicemgt/app/modules/policy.js | 2 +- .../jaggeryapps/devicemgt/app/modules/user.js | 2 +- 15 files changed, 43 insertions(+), 43 deletions(-) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/{ => oauth}/token-handlers.js (83%) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/{ => oauth}/token-protected-service-invokers.js (99%) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/{ => oauth}/util.js (90%) 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 59c142ff2c..6777383200 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/token-protected-service-invokers.js")["invokers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 a1d496f174..74ba1290d4 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/token-protected-service-invokers.js")["invokers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 46ac2913f5..cfce1f0409 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/token-protected-service-invokers.js")["invokers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 29da7a76b9..741bf1ed53 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/token-protected-service-invokers.js")["invokers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 a08a662588..99fa61a9f9 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/token-protected-service-invokers.js")["invokers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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/user-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag index a797c2f3fa..24aad8ece9 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,8 +27,8 @@ 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/token-handlers.js")["handlers"]; -var util = require("/app/modules/util.js").util; +var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; +var util = require("/app/modules/oauth/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/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/device.js index d6f24bd913..085b9b7ea1 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/token-protected-service-invokers.js")["invokers"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 06b8dcbf3d..549d0d8787 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/token-protected-service-invokers.js")["invokers"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 d282333644..9c11436e2d 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/token-handlers.js")["handlers"]; + var apiWrapperUtil = require("/app/modules/oauth/token-handlers.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/token-handlers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js similarity index 83% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/token-handlers.js rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js index 097732c059..030b1cd11d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/token-handlers.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js @@ -23,9 +23,9 @@ * ----------------------------------------------------- */ var handlers = function () { - var log = new Log("/app/modules/token-handlers.js"); + var log = new Log("/app/modules/oauth/token-handlers.js"); - var tokenUtil = require("/app/modules/util.js")["util"]; + var tokenUtil = require("/app/modules/oauth/util.js")["util"]; var constants = require("/app/modules/constants.js"); var devicemgtProps = require("/app/conf/reader/main.js")["conf"]; @@ -34,26 +34,26 @@ var handlers = function () { privateMethods.setUpEncodedTenantBasedClientAppCredentials = function (username) { if (!username) { - throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant based " + + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + "client credentials to session context. No username is found as " + "input - setUpEncodedTenantBasedClientAppCredentials(x)"); } else { var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); if (!dynamicClientAppCredentials) { - throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant based " + + 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)"); } else { var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials); if (!jwtToken) { - throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant based " + + 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 tenantBasedClientCredentials = tokenUtil. getTenantBasedClientAppCredentials(username, jwtToken); if (!tenantBasedClientCredentials) { - throw new Error("{/app/modules/token-handlers.js} Could not set up encoded tenant " + + 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 { @@ -70,14 +70,14 @@ var handlers = function () { publicMethods.setupAccessTokenPairByPasswordGrantType = function (username, password) { if (!username || !password) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + throw new Error("{/app/modules/oauth/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.setUpEncodedTenantBasedClientAppCredentials(username); var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); if (!encodedClientCredentials) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " + "password grant type. Encoded client credentials are " + "missing - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { @@ -92,7 +92,7 @@ var handlers = function () { getAccessTokenByPasswordGrantType(username, encodeURIComponent(password), encodedClientCredentials, stringOfScopes); if (!accessTokenPair) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access " + + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access " + "token pair by password grant type. Error in token " + "retrieval - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { @@ -105,14 +105,14 @@ var handlers = function () { publicMethods.setupAccessTokenPairBySamlGrantType = function (username, samlToken) { if (!username || !samlToken) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair by " + + throw new Error("{/app/modules/oauth/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.setUpEncodedTenantBasedClientAppCredentials(username); var encodedClientCredentials = session.get(constants["ENCODED_CLIENT_KEYS_IDENTIFIER"]); if (!encodedClientCredentials) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access token pair " + + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + "by saml grant type. Encoded client credentials are " + "missing - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { @@ -121,7 +121,7 @@ var handlers = function () { accessTokenPair = tokenUtil. getAccessTokenBySAMLGrantType(samlToken, encodedClientCredentials, "PRODUCTION"); if (!accessTokenPair) { - throw new Error("{/app/modules/token-handlers.js} Could not set up access token " + + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token " + "pair by password grant type. Error in token " + "retrieval - setupAccessTokenPairByPasswordGrantType(x, y)"); } else { @@ -137,14 +137,14 @@ var handlers = function () { // 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 " + + throw new Error("{/app/modules/oauth/token-handlers.js} Error in refreshing tokens. Either the access " + "token pair, encoded client credentials or both input are not found under " + "session context - refreshAccessToken()"); } else { var newTokenPair = tokenUtil. getNewAccessTokenByRefreshToken(accessTokenPair["refreshToken"], encodedClientCredentials); if (!newTokenPair) { - log.error("{/app/modules/token-handlers.js} Error in refreshing access token. Unable to update " + + log.error("{/app/modules/oauth/token-handlers.js} Error in refreshing access token. Unable to update " + "session context with new access token pair - refreshAccessToken()"); } else { session.put(constants["ACCESS_TOKEN_PAIR_IDENTIFIER"], stringify(newTokenPair)); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/token-protected-service-invokers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js similarity index 99% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/token-protected-service-invokers.js rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js index f1d4b33946..0ff97f851e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/token-protected-service-invokers.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-protected-service-invokers.js @@ -24,7 +24,7 @@ * ---------------------------------------------------------------------------- */ var invokers = function () { - var log = new Log("/app/modules/token-protected-service-invokers.js"); + var log = new Log("/app/modules/oauth/token-protected-service-invokers.js"); var publicXMLHTTPInvokers = {}; var publicHTTPClientInvokers = {}; @@ -38,7 +38,7 @@ var invokers = 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/token-handlers.js")["handlers"]; + var tokenUtil = require("/app/modules/oauth/token-handlers.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/util.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/util.js similarity index 90% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/util.js rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/util.js index c9328d8cbd..3776857960 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/util.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/util.js @@ -17,7 +17,7 @@ */ var util = function () { - var log = new Log("/app/modules/util.js"); + var log = new Log("/app/modules/oauth/util.js"); var privateMethods = {}; var publicMethods = {}; @@ -64,11 +64,11 @@ var util = function () { dynamicClientAppCredentials["clientId"] = responsePayload["client_id"]; dynamicClientAppCredentials["clientSecret"] = responsePayload["client_secret"]; } else if (xhr["status"] == 400) { - log.error("{/app/modules/util.js - getDynamicClientAppCredentials()} " + + log.error("{/app/modules/oauth/util.js - getDynamicClientAppCredentials()} " + "Bad request. Invalid data provided as dynamic client application properties."); dynamicClientAppCredentials = null; } else { - log.error("{/app/modules/util.js - getDynamicClientAppCredentials()} " + + log.error("{/app/modules/oauth/util.js - getDynamicClientAppCredentials()} " + "Error in retrieving dynamic client credentials."); dynamicClientAppCredentials = null; } @@ -78,7 +78,7 @@ var util = function () { publicMethods.getAccessTokenByPasswordGrantType = function (username, password, encodedClientAppCredentials, scopes) { if (!username || !password || !encodedClientAppCredentials || !scopes) { - log.error("{/app/modules/util.js} Error in retrieving access token by password " + + log.error("{/app/modules/oauth/util.js} Error in retrieving access token by password " + "grant type. No username, password, encoded client app credentials or scopes are " + "found - getAccessTokenByPasswordGrantType(a, b, c, d)"); return null; @@ -101,7 +101,7 @@ var util = function () { tokenPair["refreshToken"] = responsePayload["refresh_token"]; return tokenPair; } else { - log.error("{/app/modules/util.js} Error in retrieving access token by password " + + log.error("{/app/modules/oauth/util.js} Error in retrieving access token by password " + "grant type - getAccessTokenByPasswordGrantType(a, b, c, d)"); return null; } @@ -110,7 +110,7 @@ var util = function () { publicMethods.getAccessTokenBySAMLGrantType = function (assertion, encodedClientAppCredentials, scopes) { if (!assertion || !encodedClientAppCredentials || !scopes) { - log.error("{/app/modules/util.js} Error in retrieving access token by saml " + + log.error("{/app/modules/oauth/util.js} Error in retrieving access token by saml " + "grant type. No assertion, encoded client app credentials or scopes are " + "found - getAccessTokenBySAMLGrantType(x, y, z)"); return null; @@ -127,7 +127,7 @@ var util = function () { var extractedAssertion; if (assertionStartIndex == -1 || assertionEndIndex == -1) { - log.error("{/app/modules/util.js} Error in retrieving access token by saml grant type. " + + log.error("{/app/modules/oauth/util.js} Error in retrieving access token by saml grant type. " + "Issue in assertion format - getAccessTokenBySAMLGrantType(x, y, z)"); return null; } else { @@ -153,7 +153,7 @@ var util = function () { tokenPair["refreshToken"] = responsePayload["refresh_token"]; return tokenPair; } else { - log.error("{/app/modules/util.js} Error in retrieving access token by password " + + log.error("{/app/modules/oauth/util.js} Error in retrieving access token by password " + "grant type - getAccessTokenBySAMLGrantType(x, y, z)"); return null; } @@ -163,7 +163,7 @@ var util = function () { publicMethods.getNewAccessTokenByRefreshToken = function (refreshToken, encodedClientAppCredentials, scopes) { if (!refreshToken || !encodedClientAppCredentials) { - log.error("{/app/modules/util.js} Error in retrieving new access token by current " + + log.error("{/app/modules/oauth/util.js} Error in retrieving new access token by current " + "refresh token. No refresh token or encoded client app credentials are " + "found - getNewAccessTokenByRefreshToken(x, y, z)"); return null; @@ -187,7 +187,7 @@ var util = function () { tokenPair["refreshToken"] = responsePayload["refresh_token"]; return tokenPair; } else { - log.error("{/app/modules/util.js} Error in retrieving new access token by " + + log.error("{/app/modules/oauth/util.js} Error in retrieving new access token by " + "current refresh token - getNewAccessTokenByRefreshToken(x, y, z)"); return null; } @@ -196,7 +196,7 @@ var util = function () { publicMethods.getAccessTokenByJWTGrantType = function (clientAppCredentials) { if (!clientAppCredentials) { - log.error("{/app/modules/util.js} Error in retrieving new access token by current refresh token. " + + log.error("{/app/modules/oauth/util.js} Error in retrieving new access token by current refresh token. " + "No client app credentials are found as input - getAccessTokenByJWTGrantType(x)"); return null; } else { @@ -212,13 +212,13 @@ var util = function () { publicMethods.getTenantBasedClientAppCredentials = function (username, jwtToken) { if (!username || !jwtToken) { - log.error("{/app/modules/util.js} Error in retrieving tenant based client app " + + log.error("{/app/modules/oauth/util.js} Error in retrieving tenant based client app " + "credentials. No username or jwt token is found as input - getTenantBasedClientAppCredentials(x, y)"); return null; } else { var tenantDomain = carbon.server.tenantDomain({username: username}); if (!tenantDomain) { - log.error("{/app/modules/util.js} Error in retrieving tenant based client application " + + log.error("{/app/modules/oauth/util.js} Error in retrieving tenant based client application " + "credentials. Unable to obtain a valid tenant domain for provided " + "username - getTenantBasedClientAppCredentials(x, y)"); return null; @@ -249,7 +249,7 @@ var util = function () { setCachedTenantBasedClientAppCredentials(tenantDomain, tenantBasedClientAppCredentials); return tenantBasedClientAppCredentials; } else { - log.error("{/app/modules/util.js} Error in retrieving tenant based client " + + log.error("{/app/modules/oauth/util.js} Error in retrieving tenant based client " + "application credentials from API Manager - getTenantBasedClientAppCredentials(x, y)"); return null; } 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 dac693543b..3b1e11a9c6 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/token-protected-service-invokers.js")["invokers"];; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 60e53b3ae3..0fbe5a2116 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/token-protected-service-invokers.js")["invokers"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.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 0cf67c3213..2a28f5fddf 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/token-protected-service-invokers.js")["invokers"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; /* Initializing user manager */ var carbon = require("carbon");