Merge "Remove kwargs_to_fetch_token"

This commit is contained in:
Zuul 2018-04-04 19:05:55 +00:00 committed by Gerrit Code Review
commit 0b02fe90c6
3 changed files with 7 additions and 19 deletions

View File

@ -215,7 +215,6 @@ object is stored.
import binascii import binascii
import copy import copy
import datetime import datetime
import warnings
from keystoneauth1 import access from keystoneauth1 import access
from keystoneauth1 import adapter from keystoneauth1 import adapter
@ -309,12 +308,6 @@ class BaseAuthProtocol(object):
perform. 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, def __init__(self,
app, app,
log=_LOG, log=_LOG,
@ -436,14 +429,7 @@ class BaseAuthProtocol(object):
# NOTE(edmondsw): strip the token to remove any whitespace that may # NOTE(edmondsw): strip the token to remove any whitespace that may
# have been passed along in the header per bug 1689468 # have been passed along in the header per bug 1689468
token = token.strip() token = token.strip()
if self.kwargs_to_fetch_token: data = self.fetch_token(token, **kwargs)
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)
try: try:
return data, access.create(body=data, auth_token=token) return data, access.create(body=data, auth_token=token)
@ -549,8 +535,6 @@ class AuthProtocol(BaseAuthProtocol):
_SIGNING_CERT_FILE_NAME = 'signing_cert.pem' _SIGNING_CERT_FILE_NAME = 'signing_cert.pem'
_SIGNING_CA_FILE_NAME = 'cacert.pem' _SIGNING_CA_FILE_NAME = 'cacert.pem'
kwargs_to_fetch_token = True
def __init__(self, app, conf): def __init__(self, app, conf):
log = logging.getLogger(conf.get('log_name', __name__)) log = logging.getLogger(conf.get('log_name', __name__))
log.info('Starting Keystone auth_token middleware') log.info('Starting Keystone auth_token middleware')

View File

@ -31,8 +31,6 @@ class FakeApp(object):
class FetchingMiddleware(auth_token.BaseAuthProtocol): class FetchingMiddleware(auth_token.BaseAuthProtocol):
kwargs_to_fetch_token = True
def __init__(self, app, token_dict={}, **kwargs): def __init__(self, app, token_dict={}, **kwargs):
super(FetchingMiddleware, self).__init__(app, **kwargs) super(FetchingMiddleware, self).__init__(app, **kwargs)
self.token_dict = token_dict self.token_dict = token_dict

View File

@ -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.