diff --git a/shelfmark/config/security_handlers.py b/shelfmark/config/security_handlers.py index 17cef37..35fb23b 100644 --- a/shelfmark/config/security_handlers.py +++ b/shelfmark/config/security_handlers.py @@ -34,6 +34,7 @@ def on_save_security( normalized_values["OIDC_DISCOVERY_URL"] = normalize_http_url( str(discovery_url), default_scheme="https", + strip_trailing_slash=False, ) proxy_logout_url = normalized_values.get("PROXY_AUTH_LOGOUT_URL") diff --git a/tests/config/test_security.py b/tests/config/test_security.py index 1b2be24..86b5705 100644 --- a/tests/config/test_security.py +++ b/tests/config/test_security.py @@ -435,7 +435,9 @@ class TestSecurityOnSave: assert result["error"] is False - def test_on_save_normalizes_oidc_discovery_url(self, tmp_path, monkeypatch): + def test_on_save_normalizes_oidc_discovery_url_without_stripping_trailing_slash( + self, tmp_path, monkeypatch + ): from shelfmark.config.security import _on_save_security monkeypatch.setenv("CONFIG_DIR", str(tmp_path)) @@ -446,7 +448,7 @@ class TestSecurityOnSave: assert result["error"] is False assert ( result["values"]["OIDC_DISCOVERY_URL"] - == "https://auth.example.com/.well-known/openid-configuration" + == "https://auth.example.com/.well-known/openid-configuration/" ) def test_on_save_normalizes_proxy_logout_url(self, tmp_path, monkeypatch):