Skip to content

Commit

Permalink
added interface override support for keystoneauth's client
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudolf Vriend committed Jan 9, 2019
1 parent d526953 commit f4bf856
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion keystonemiddleware/auth_token/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,8 @@ def _create_identity_server(self):
self.log,
adap,
include_service_catalog=self._include_service_catalog,
requested_auth_version=auth_version)
requested_auth_version=auth_version,
interface=self._conf.get('auth_interface'))

def _create_oslo_cache(self):
# having this as a function makes test mocking easier
Expand Down
13 changes: 8 additions & 5 deletions keystonemiddleware/auth_token/_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ class _RequestStrategy(object):

AUTH_VERSION = None

def __init__(self, adap, include_service_catalog=None):
def __init__(self, adap, include_service_catalog=None, interface='admin'):
self._include_service_catalog = include_service_catalog
self._interface = interface

def verify_token(self, user_token, allow_expired=False):
pass
Expand Down Expand Up @@ -71,7 +72,7 @@ class _V2RequestStrategy(_RequestStrategy):

def __init__(self, adap, **kwargs):
super(_V2RequestStrategy, self).__init__(adap, **kwargs)
self._client = v2_client.Client(session=adap)
self._client = v2_client.Client(session=adap, interface=self._interface)

def verify_token(self, token, allow_expired=False):
# NOTE(jamielennox): allow_expired is ignored on V2
Expand Down Expand Up @@ -99,7 +100,7 @@ class _V3RequestStrategy(_RequestStrategy):

def __init__(self, adap, **kwargs):
super(_V3RequestStrategy, self).__init__(adap, **kwargs)
self._client = v3_client.Client(session=adap)
self._client = v3_client.Client(session=adap, interface=self._interface)

def verify_token(self, token, allow_expired=False):
auth_ref = self._client.tokens.validate(
Expand Down Expand Up @@ -137,11 +138,12 @@ class IdentityServer(object):
"""

def __init__(self, log, adap, include_service_catalog=None,
requested_auth_version=None):
requested_auth_version=None, interface='admin'):
self._LOG = log
self._adapter = adap
self._include_service_catalog = include_service_catalog
self._requested_auth_version = requested_auth_version
self._interface = interface

# Built on-demand with self._request_strategy.
self._request_strategy_obj = None
Expand Down Expand Up @@ -172,7 +174,8 @@ def _request_strategy(self):

self._request_strategy_obj = strategy_class(
self._adapter,
include_service_catalog=self._include_service_catalog)
include_service_catalog=self._include_service_catalog,
interface=self._interface)

return self._request_strategy_obj

Expand Down

0 comments on commit f4bf856

Please sign in to comment.