From 8e9255d56d2da16a7fec4f57e28246bb5b9cb713 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Thu, 19 Oct 2017 14:24:40 +0800 Subject: [PATCH] Remove kwargs_to_fetch_token kwargs_to_fetch_token was deprecated and should be removed in Rocky now. Change-Id: Ic247efb84c5133449ead6a9864bbd7748e5e74bd --- keystonemiddleware/auth_token/__init__.py | 18 +----------------- .../unit/auth_token/test_base_middleware.py | 2 -- ...kwargs_to_fetch_token-20e3451ed192ab6a.yaml | 6 ++++++ 3 files changed, 7 insertions(+), 19 deletions(-) create mode 100644 releasenotes/notes/remove_kwargs_to_fetch_token-20e3451ed192ab6a.yaml diff --git a/keystonemiddleware/auth_token/__init__.py b/keystonemiddleware/auth_token/__init__.py index 67668185..98c47f5c 100644 --- a/keystonemiddleware/auth_token/__init__.py +++ b/keystonemiddleware/auth_token/__init__.py @@ -215,7 +215,6 @@ object is stored. import binascii import copy import datetime -import warnings from keystoneauth1 import access from keystoneauth1 import adapter @@ -309,12 +308,6 @@ class BaseAuthProtocol(object): perform. """ - # NOTE(jamielennox): Default to True and remove in Queens. This is a - # compatibility flag to allow passing **kwargs to fetch_token(). This - # is basically to allow compatibility with keystone's override. We will - # assume all subclasses are ok with this being True in the Queens release. - kwargs_to_fetch_token = False - def __init__(self, app, log=_LOG, @@ -436,14 +429,7 @@ class BaseAuthProtocol(object): # NOTE(edmondsw): strip the token to remove any whitespace that may # have been passed along in the header per bug 1689468 token = token.strip() - if self.kwargs_to_fetch_token: - data = self.fetch_token(token, **kwargs) - else: - m = _('Implementations of auth_token must set ' - 'kwargs_to_fetch_token this will be the required and ' - 'assumed in Queens.') - warnings.warn(m) - data = self.fetch_token(token) + data = self.fetch_token(token, **kwargs) try: return data, access.create(body=data, auth_token=token) @@ -549,8 +535,6 @@ class AuthProtocol(BaseAuthProtocol): _SIGNING_CERT_FILE_NAME = 'signing_cert.pem' _SIGNING_CA_FILE_NAME = 'cacert.pem' - kwargs_to_fetch_token = True - def __init__(self, app, conf): log = logging.getLogger(conf.get('log_name', __name__)) log.info('Starting Keystone auth_token middleware') diff --git a/keystonemiddleware/tests/unit/auth_token/test_base_middleware.py b/keystonemiddleware/tests/unit/auth_token/test_base_middleware.py index 32e43382..a3c06bc7 100644 --- a/keystonemiddleware/tests/unit/auth_token/test_base_middleware.py +++ b/keystonemiddleware/tests/unit/auth_token/test_base_middleware.py @@ -31,8 +31,6 @@ class FakeApp(object): class FetchingMiddleware(auth_token.BaseAuthProtocol): - kwargs_to_fetch_token = True - def __init__(self, app, token_dict={}, **kwargs): super(FetchingMiddleware, self).__init__(app, **kwargs) self.token_dict = token_dict diff --git a/releasenotes/notes/remove_kwargs_to_fetch_token-20e3451ed192ab6a.yaml b/releasenotes/notes/remove_kwargs_to_fetch_token-20e3451ed192ab6a.yaml new file mode 100644 index 00000000..147a77bd --- /dev/null +++ b/releasenotes/notes/remove_kwargs_to_fetch_token-20e3451ed192ab6a.yaml @@ -0,0 +1,6 @@ +--- +other: + - > + The ``kwargs_to_fetch_token`` setting was removed from the + ``BaseAuthProtocol`` class. Implementations of auth_token now assume kwargs + will be passed to the ``fetch_token`` method.