From 50fddc146d7a600f69808bda24edda87ceb30898 Mon Sep 17 00:00:00 2001 From: Will Cater Date: Tue, 25 Feb 2025 07:42:44 -0500 Subject: [PATCH 1/3] Hardcoded Keycloak paths --- .pre-commit-config.yaml | 2 +- backend/ibutsu_server/util/keycloak.py | 3 +-- frontend/src/services/keycloak.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f78bd91..0c82efe1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 + rev: v0.9.7 hooks: - id: ruff args: diff --git a/backend/ibutsu_server/util/keycloak.py b/backend/ibutsu_server/util/keycloak.py index ee30316c..421de094 100644 --- a/backend/ibutsu_server/util/keycloak.py +++ b/backend/ibutsu_server/util/keycloak.py @@ -26,8 +26,7 @@ def get_keycloak_config(is_private=False): "authorization_url": build_url(realm_base_url, "protocol/openid-connect/auth"), "realm": realm, "client_id": current_app.config.get("KEYCLOAK_CLIENT_ID"), - "redirect_uri": backend_url - + current_app.config.get("KEYCLOAK_AUTH_PATH", "/login/auth/keycloak"), + "redirect_uri": backend_url + "/login/keycloak", } if current_app.config.get("KEYCLOAK_ICON"): config["icon"] = current_app.config["KEYCLOAK_ICON"] diff --git a/frontend/src/services/keycloak.js b/frontend/src/services/keycloak.js index b57c4d20..3f52876c 100644 --- a/frontend/src/services/keycloak.js +++ b/frontend/src/services/keycloak.js @@ -6,6 +6,6 @@ export class KeycloakService { static login(url, realm, client_id) { const keycloakInstance = new Keycloak({url: url, realm: realm, clientId: client_id}); keycloakInstance.init({onLoad: 'login-required', checkLoginIframe: false, responseMode: 'query', - redirectUri: Settings.serverUrl + (Settings.keycloakAuthPath || '/login/auth/keycloak') }); + redirectUri: Settings.serverUrl + '/login/keycloak' }); } } From 68e0915f944a0516ac8c202577ec717db8bc9527 Mon Sep 17 00:00:00 2001 From: Will Cater Date: Tue, 25 Feb 2025 09:35:28 -0500 Subject: [PATCH 2/3] Removed /auth from server_url --- backend/ibutsu_server/util/keycloak.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/ibutsu_server/util/keycloak.py b/backend/ibutsu_server/util/keycloak.py index 421de094..5ea27fc2 100644 --- a/backend/ibutsu_server/util/keycloak.py +++ b/backend/ibutsu_server/util/keycloak.py @@ -17,8 +17,8 @@ def get_keycloak_config(is_private=False): if not backend_url.endswith("/api"): backend_url += "/api" server_url = current_app.config["KEYCLOAK_BASE_URL"] - if not server_url.endswith("auth"): - server_url = build_url(server_url, "auth") + #if not server_url.endswith("auth"): + # server_url = build_url(server_url, "auth") realm = current_app.config.get("KEYCLOAK_REALM") realm_base_url = build_url(server_url, "realms", realm) config = { From bb6c7128ebeb2135d6738b4ae7169cfdd92f2bb1 Mon Sep 17 00:00:00 2001 From: Will Cater Date: Tue, 25 Feb 2025 09:38:54 -0500 Subject: [PATCH 3/3] Linting changes --- backend/ibutsu_server/util/keycloak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/ibutsu_server/util/keycloak.py b/backend/ibutsu_server/util/keycloak.py index 5ea27fc2..0a2fa22b 100644 --- a/backend/ibutsu_server/util/keycloak.py +++ b/backend/ibutsu_server/util/keycloak.py @@ -17,7 +17,7 @@ def get_keycloak_config(is_private=False): if not backend_url.endswith("/api"): backend_url += "/api" server_url = current_app.config["KEYCLOAK_BASE_URL"] - #if not server_url.endswith("auth"): + # if not server_url.endswith("auth"): # server_url = build_url(server_url, "auth") realm = current_app.config.get("KEYCLOAK_REALM") realm_base_url = build_url(server_url, "realms", realm)