Merge "MFA: Fixed Issue: XAuthToken contains MFA passcode"
This commit is contained in:
commit
a20eb3bf83
@ -63,9 +63,11 @@ class MemoizedAuthServiceComposite(object):
|
||||
# Also add this to get_access_data() in the AuthProvider class
|
||||
pass
|
||||
token_client = RaxToken_MFA_API_Client(
|
||||
auth_endpoint, 'json', 'json', passcode)
|
||||
url=auth_endpoint, serialize_format='json',
|
||||
deserialize_format='json')
|
||||
token_behaviors = RaxToken_MFA_API_Behaviors(token_client)
|
||||
return token_behaviors.get_access_data(username, password, tenant_id)
|
||||
return token_behaviors.get_access_data(
|
||||
username=username, password=password, tenant_id=tenant_id)
|
||||
|
||||
@classmethod
|
||||
@memoized
|
||||
@ -169,11 +171,12 @@ class AuthProvider(object):
|
||||
# use an external service (e.g. - SMS) to provide the passcode
|
||||
pass
|
||||
token_client = RaxToken_MFA_API_Client(
|
||||
endpoint_config.auth_endpoint, 'json', 'json', passcode)
|
||||
url=endpoint_config.auth_endpoint,
|
||||
serialize_format='json', deserialize_format='json')
|
||||
token_behaviors = RaxToken_MFA_API_Behaviors(token_client)
|
||||
return token_behaviors.get_access_data(user_config.username,
|
||||
user_config.api_key,
|
||||
user_config.tenant_id)
|
||||
return token_behaviors.get_access_data(
|
||||
username=user_config.username, password=user_config.password,
|
||||
tenant_id=user_config.tenant_id, passcode=passcode)
|
||||
|
||||
elif endpoint_config.strategy.lower() == 'saio_tempauth':
|
||||
auth_client = SaioAuthAPI_Client(endpoint_config.auth_endpoint)
|
||||
|
@ -92,19 +92,16 @@ class TokenAPI_Client(BaseTokenAPI_Client):
|
||||
|
||||
|
||||
class MFA_TokenAPI_Client(BaseTokenAPI_Client):
|
||||
def __init__(self, url, serialize_format, deserialize_format=None,
|
||||
auth_token=None):
|
||||
def __init__(self, url, serialize_format, deserialize_format=None):
|
||||
super(MFA_TokenAPI_Client, self).__init__(
|
||||
serialize_format, deserialize_format)
|
||||
|
||||
self.base_url = '{0}/{1}'.format(url, _version)
|
||||
self.default_headers['Content-Type'] = 'application/{0}'.format(
|
||||
serialize_format)
|
||||
self.default_headers['Accept'] = 'application/{0}'.format(
|
||||
serialize_format)
|
||||
|
||||
if auth_token is not None:
|
||||
self.default_headers['X-Auth-Token'] = auth_token
|
||||
|
||||
def authenticate(self, username, password, tenant_id,
|
||||
requestslib_kwargs=None):
|
||||
"""
|
||||
@ -123,7 +120,7 @@ class MFA_TokenAPI_Client(BaseTokenAPI_Client):
|
||||
username=username, password=password, tenant_id=tenant_id)
|
||||
url = '{0}/{1}'.format(self.base_url, _tokens)
|
||||
return self.post(url, request_entity=request_entity,
|
||||
requestslib_kwargs=requestslib_kwargs)
|
||||
requestslib_kwargs=requestslib_kwargs)
|
||||
|
||||
def authenticate_passcode(self, session_id, passcode,
|
||||
requestslib_kwargs=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user