Skip to content

Commit c9c7f5b

Browse files
authored
Merge pull request #9 from makinacorpus/drf_spectacular_support
Support url ending with .well_known/configuration in swagger config
2 parents d7db7b1 + 0eaa146 commit c9c7f5b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

django_pyoidc/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.8
1+
0.0.9

django_pyoidc/drf/schema.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from urllib.parse import urljoin
2+
13
try:
24
from drf_spectacular.extensions import OpenApiAuthenticationExtension
35

@@ -14,6 +16,10 @@ def get_security_definition(self, auto_schema):
1416

1517
op = OIDCBearerAuthentication.extract_drf_opname()
1618
well_known_url = get_setting_for_sso_op(op, "OIDC_PROVIDER_DISCOVERY_URI")
19+
if not well_known_url.endswith(".well-known/openid-configuration"):
20+
well_known_url = urljoin(
21+
well_known_url, ".well-known/openid-configuration"
22+
)
1723
return {"type": "openIdConnect", "openIdConnectUrl": well_known_url}
1824

1925
except ImportError:

0 commit comments

Comments
 (0)