Skip to content

Commit

Permalink
Merge pull request #9 from makinacorpus/drf_spectacular_support
Browse files Browse the repository at this point in the history
Support url ending with .well_known/configuration in swagger config
  • Loading branch information
gbip authored Jun 17, 2024
2 parents d7db7b1 + 0eaa146 commit c9c7f5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django_pyoidc/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
0.0.9
6 changes: 6 additions & 0 deletions django_pyoidc/drf/schema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.parse import urljoin

try:
from drf_spectacular.extensions import OpenApiAuthenticationExtension

Expand All @@ -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:
Expand Down

0 comments on commit c9c7f5b

Please sign in to comment.