From 430fc44b6618a8c1245566a747a8d0e8f983db81 Mon Sep 17 00:00:00 2001 From: Biswajit Mandal Date: Fri, 13 Jul 2018 18:33:36 +0000 Subject: [PATCH] Add project also while serializing v3 token to v2 data. Add whole token data except catalog (as it may be huge data) while computing v3 token. Add project(v3) and tenant(v2.0) key inside token. Change-Id: I82c22fda9fbaea24587f6f1712d4861fc930ca34 Partial-Bug: #1781341 (cherry picked from commit dccf19365ff9f2d010cfb08968214676945fb070) --- .../orchestration/plugins/openstack/keystone.api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/serverroot/orchestration/plugins/openstack/keystone.api.js b/src/serverroot/orchestration/plugins/openstack/keystone.api.js index 45928245c..36ba76333 100644 --- a/src/serverroot/orchestration/plugins/openstack/keystone.api.js +++ b/src/serverroot/orchestration/plugins/openstack/keystone.api.js @@ -751,6 +751,7 @@ function getV3TokenByAuthObj (authObj, callback) var authPort = authServerDetails.authServerPort; var authProto = null; var reqUrl = '/v3/auth/tokens'; + var tokenId = ''; reqUrl = addUrlPrefix(reqUrl); var tmpAuthRestObj = getAuthRestApiInst(authObj.req, reqUrl); @@ -766,7 +767,8 @@ function getV3TokenByAuthObj (authObj, callback) 'headers;x-subject-token', null, false); if (null != token) { - tokenObj['id'] = removeSpecialChars(token); + tokenId = removeSpecialChars(token); + tokenObj['id'] = tokenId; } } if (null != authObj['tenant']) { @@ -777,7 +779,10 @@ function getV3TokenByAuthObj (authObj, callback) function(err, data) { if ((null == err) && (null != data) && (null != data['token']) && (null != data['token']['project'])) { + tokenObj = data['token'] tokenObj['tenant'] = data['token']['project']; + tokenObj['id'] = tokenId; + delete tokenObj['catalog']; callback(err, tokenObj); } else { callback(err, tokenObj); @@ -865,6 +870,7 @@ function formatV3AuthDataToV2AuthData (v3AuthData, authObj, callback) null); if (null != tokenProj) { tokenObj['access']['token']['tenant'] = tokenProj; + tokenObj['access']['token']['project'] = tokenProj; } } tokenObj['access']['serviceCatalog'] = v3AuthData['token']['catalog'];