Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions keystoneclient/auth/identity/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def get_auth_data(self, session, auth, headers, **kwargs):
class AuthConstructor(Auth):
"""AuthConstructor is a means of creating an Auth Plugin that contains
only one authentication method. This is generally the required usage.

An AuthConstructor creates an AuthMethod based on the method's
arguments and the auth_method_class defined by the plugin. It then
creates the auth plugin with only that authentication method.
Expand Down Expand Up @@ -261,7 +260,7 @@ def get_options(cls):

class TokenMethod(AuthMethod):

_method_parameters = ['token']
_method_parameters = ['token', 'refresh_token']

def __init__(self, **kwargs):
"""Construct an Auth plugin to fetch a token from a token.
Expand All @@ -272,7 +271,10 @@ def __init__(self, **kwargs):

def get_auth_data(self, session, auth, headers, **kwargs):
headers['X-Auth-Token'] = self.token
return 'token', {'id': self.token}
payload = {'id': self.token}
if self.refresh_token:
payload['refresh'] = True
return 'token', payload


class Token(AuthConstructor):
Expand Down
5 changes: 4 additions & 1 deletion keystoneclient/v3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def __init__(self, **kwargs):

# DEPRECATED: if session is passed then we go to the new behaviour of
# authenticating on the first required call.

self._refresh_token = kwargs.get('refresh_token', False)

if 'session' not in kwargs and self.management_url is None:
self.authenticate()

Expand Down Expand Up @@ -239,7 +242,7 @@ def get_raw_token_from_identity_service(self, auth_url, user_id=None,
auth_methods = []

if token:
auth_methods.append(v3_auth.TokenMethod(token=token))
auth_methods.append(v3_auth.TokenMethod(token=token, refresh_token=self._refresh_token))

if password:
m = v3_auth.PasswordMethod(user_id=user_id,
Expand Down