Skip to content

Commit

Permalink
Add project also while serializing v3 token to v2 data.
Browse files Browse the repository at this point in the history
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 dccf193)
  • Loading branch information
biswajit-mandal committed Jul 23, 2018
1 parent 2d913ec commit 430fc44
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -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);

Expand All @@ -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']) {
Expand All @@ -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);
Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit 430fc44

Please sign in to comment.