Merge "Do not require the token_id for converting v3 to v2 tokens"

This commit is contained in:
Jenkins 2015-08-18 01:15:42 +00:00 committed by Gerrit Code Review
commit 5839ffa238
2 changed files with 6 additions and 6 deletions

View File

@ -37,13 +37,12 @@ CONF = cfg.CONF
class V2TokenDataHelper(object):
"""Creates V2 token data."""
def v3_to_v2_token(self, token_id, v3_token_data):
def v3_to_v2_token(self, v3_token_data):
token_data = {}
# Build v2 token
v3_token = v3_token_data['token']
token = {}
token['id'] = token_id
token['expires'] = v3_token.get('expires_at')
token['issued_at'] = v3_token.get('issued_at')
token['audit_ids'] = v3_token.get('audit_ids')

View File

@ -94,8 +94,8 @@ class Provider(common.BaseProvider):
project_id=project_id)
self._build_issued_at_info(token_id, v3_token_data)
# Convert v3 to v2 token data and build v2 catalog
token_data = self.v2_token_data_helper.v3_to_v2_token(token_id,
v3_token_data)
token_data = self.v2_token_data_helper.v3_to_v2_token(v3_token_data)
token_data['access']['token']['id'] = token_id
return token_id, token_data
@ -196,8 +196,9 @@ class Provider(common.BaseProvider):
token=token_ref,
include_catalog=False,
audit_info=audit_ids)
return self.v2_token_data_helper.v3_to_v2_token(token_ref,
v3_token_data)
token_data = self.v2_token_data_helper.v3_to_v2_token(v3_token_data)
token_data['access']['token']['id'] = token_ref
return token_data
def validate_v3_token(self, token):
"""Validate a V3 formatted token.