make user_info_endpoint_url independent of auth_url

Change-Id: I282fcf8bffd2286c32e3d549c98eaae130902d73
This commit is contained in:
Eyal 2018-10-14 08:50:37 +03:00
parent 269c7fb6f9
commit 513bd5c5a4

View File

@ -106,8 +106,11 @@ class KeycloakAuth(base.ConfigurableMiddleware):
self._unauthorized(message)
def call_keycloak(self):
endpoint = ('%s' + self.user_info_endpoint_url) % (self.auth_url,
self.realm_name)
if self.user_info_endpoint_url.startswith(('http://', 'https://')):
endpoint = self.user_info_endpoint_url
else:
endpoint = ('%s' + self.user_info_endpoint_url) % \
(self.auth_url, self.realm_name)
headers = {'Authorization': 'Bearer %s' % self.token}
verify = None
if urllib.parse.urlparse(endpoint).scheme == "https":