Skip to content

Commit

Permalink
Added logic for different keycloak auth paths (#567)
Browse files Browse the repository at this point in the history
* Added logic for different keycloak auth paths

* Modified code with suggestions

* Fixed linting issues

Hardcoded Keycloak paths

Removed /auth from server_url

Linting changes

Hardcoded Keycloak paths (#577)

Added debug for frontend login
  • Loading branch information
wcater803 committed Feb 27, 2025
1 parent 7214327 commit cd4df1b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: debug-statements

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.9.7
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion backend/ibutsu_server/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
5 changes: 3 additions & 2 deletions backend/ibutsu_server/util/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ 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)
print("Checking server_url:", server_url)
config = {
"server_url": server_url,
"authorization_url": build_url(realm_base_url, "protocol/openid-connect/auth"),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/services/keycloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '/login/auth/keycloak' });
}
}

0 comments on commit cd4df1b

Please sign in to comment.