From ea2e5263387054b2893dffed47ebf5acc53bd5c6 Mon Sep 17 00:00:00 2001 From: wcater803 <96142740+wcater803@users.noreply.github.com> Date: Mon, 24 Feb 2025 10:50:56 -0500 Subject: [PATCH] Added logic for different keycloak auth paths (#567) * Added logic for different keycloak auth paths * Modified code with suggestions * Fixed linting issues --- .pre-commit-config.yaml | 2 +- backend/ibutsu_server/constants.py | 2 +- backend/ibutsu_server/util/keycloak.py | 3 ++- frontend/src/services/keycloak.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 84566736..6f78bd91 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.8.2 + rev: v0.9.6 hooks: - id: ruff args: diff --git a/backend/ibutsu_server/constants.py b/backend/ibutsu_server/constants.py index 55def834..a6a6ece9 100644 --- a/backend/ibutsu_server/constants.py +++ b/backend/ibutsu_server/constants.py @@ -118,7 +118,7 @@ "params": [ { "name": "filters", - "description": "The filters for the runs to be included" " in the query.", + "description": "The filters for the runs to be included in the query.", "type": "string", "required": True, }, diff --git a/backend/ibutsu_server/util/keycloak.py b/backend/ibutsu_server/util/keycloak.py index 61a46e01..ee30316c 100644 --- a/backend/ibutsu_server/util/keycloak.py +++ b/backend/ibutsu_server/util/keycloak.py @@ -26,7 +26,8 @@ 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 + "/login/auth/keycloak", + "redirect_uri": backend_url + + current_app.config.get("KEYCLOAK_AUTH_PATH", "/login/auth/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 6f018a87..4162b7d1 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 + '/login/auth/keycloak'}); + redirectUri: Settings.serverUrl + (Settings.keycloakAuthPath || '/login/auth/keycloak') }); } }