From 513bd5c5a41bc6a5e83b2549023f640e99e4b005 Mon Sep 17 00:00:00 2001 From: Eyal Date: Sun, 14 Oct 2018 08:50:37 +0300 Subject: [PATCH] make user_info_endpoint_url independent of auth_url Change-Id: I282fcf8bffd2286c32e3d549c98eaae130902d73 --- vitrage/middleware/keycloak.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vitrage/middleware/keycloak.py b/vitrage/middleware/keycloak.py index fa331f6f7..77c249204 100644 --- a/vitrage/middleware/keycloak.py +++ b/vitrage/middleware/keycloak.py @@ -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":