diff --git a/django_pyoidc/VERSION b/django_pyoidc/VERSION index d169b2f..c5d54ec 100644 --- a/django_pyoidc/VERSION +++ b/django_pyoidc/VERSION @@ -1 +1 @@ -0.0.8 +0.0.9 diff --git a/django_pyoidc/drf/schema.py b/django_pyoidc/drf/schema.py index 9687113..c3bdb8b 100644 --- a/django_pyoidc/drf/schema.py +++ b/django_pyoidc/drf/schema.py @@ -1,3 +1,5 @@ +from urllib.parse import urljoin + try: from drf_spectacular.extensions import OpenApiAuthenticationExtension @@ -14,6 +16,10 @@ def get_security_definition(self, auto_schema): op = OIDCBearerAuthentication.extract_drf_opname() well_known_url = get_setting_for_sso_op(op, "OIDC_PROVIDER_DISCOVERY_URI") + if not well_known_url.endswith(".well-known/openid-configuration"): + well_known_url = urljoin( + well_known_url, ".well-known/openid-configuration" + ) return {"type": "openIdConnect", "openIdConnectUrl": well_known_url} except ImportError: