remove normalize_keycloak_url

This commit is contained in:
Felix Grzelka
2026-06-04 13:20:03 +00:00
parent 5cb555d6c2
commit dd2cfaa87d

View File

@@ -154,18 +154,6 @@ URL_AUTHZ_CUSTOM_POLICY = "{url}/admin/realms/{realm}/clients/{client_id}/authz/
URL_AUTHZ_CUSTOM_POLICIES = "{url}/admin/realms/{realm}/clients/{client_id}/authz/resource-server/policy" URL_AUTHZ_CUSTOM_POLICIES = "{url}/admin/realms/{realm}/clients/{client_id}/authz/resource-server/policy"
def normalize_keycloak_url(url: str) -> str:
"""Normalize Keycloak base URL for Admin REST API access.
Keycloak 17+ (Quarkus) exposes the API at the server root without an /auth prefix.
WildFly-based Keycloak used /auth as the context path. Trailing slashes are removed.
"""
url = url.rstrip("/")
if url.endswith("/auth"):
return url[:-5]
return url
def keycloak_argument_spec() -> dict[str, t.Any]: def keycloak_argument_spec() -> dict[str, t.Any]:
""" """
Returns argument_spec of options common to keycloak_*-modules Returns argument_spec of options common to keycloak_*-modules
@@ -403,7 +391,7 @@ class KeycloakAPI:
def __init__(self, module: AnsibleModule, connection_header: dict[str, str]) -> None: def __init__(self, module: AnsibleModule, connection_header: dict[str, str]) -> None:
self.module = module self.module = module
self.baseurl = normalize_keycloak_url(self.module.params.get("auth_keycloak_url")) self.baseurl = self.module.params.get("auth_keycloak_url")
self.validate_certs = self.module.params.get("validate_certs") self.validate_certs = self.module.params.get("validate_certs")
self.connection_timeout = self.module.params.get("connection_timeout") self.connection_timeout = self.module.params.get("connection_timeout")
self.restheaders = connection_header self.restheaders = connection_header