Fix for 1261

revert-70aa11f8
GDLMadushanka 7 years ago
parent f166be7d54
commit 6628d97745

Binary file not shown.

@ -45,6 +45,7 @@ if (!user) {
} else { } else {
queryString = "?" + queryString; queryString = "?" + queryString;
} }
var deviceType = request.getParameter("deviceType"); // need a better solution here var deviceType = request.getParameter("deviceType"); // need a better solution here
deviceTypeConfig = utility.getDeviceTypeConfig(deviceType); deviceTypeConfig = utility.getDeviceTypeConfig(deviceType);
if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) { if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) {

@ -39,7 +39,7 @@ var invokers = function () {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
var tokenHandler = require("/app/modules/oauth/token-handler-utils.js")["utils"];
/** /**
* This method reads the token pair from the session and return the access token. * This method reads the token pair from the session and return the access token.
* If the token pair is not set in the session, this will return null. * If the token pair is not set in the session, this will return null.
@ -259,10 +259,12 @@ var invokers = function () {
var wsRequest = new ws.WSRequest(); var wsRequest = new ws.WSRequest();
var options = []; var options = [];
if (devicemgtProps["isOAuthEnabled"]) { if (devicemgtProps["isOAuthEnabled"]) {
var accessToken = privateMethods.getAccessToken(); var adminUsername = devicemgtProps["adminUser"];
var accessToken = tokenHandler.getJwtToken(adminUsername);
var decoded = tokenHandler.encode(accessToken);
if (accessToken) { if (accessToken) {
var authenticationHeaderName = String(constants["AUTHORIZATION_HEADER"]); var authenticationHeaderName = String(constants["AUTHORIZATION_HEADER"]);
var authenticationHeaderValue = String(constants["BEARER_PREFIX"] + accessToken); var authenticationHeaderValue = String(constants["BEARER_PREFIX"] + decoded);
var headers = []; var headers = [];
var oAuthAuthenticationData = {}; var oAuthAuthenticationData = {};
oAuthAuthenticationData.name = authenticationHeaderName; oAuthAuthenticationData.name = authenticationHeaderName;

Loading…
Cancel
Save