Skip to content

Commit 06b547d

Browse files
authored
Ensure v3 smart config uses the v3 logic, boost robustness if expected fields are missing. (#1358)
1 parent 7ea1227 commit 06b547d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

apps/wellknown/views/openid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def smart_configuration_v3(request):
6565
data = build_smart_config_endpoint(data, issuer=issuer)
6666

6767
# v3 specific info, very important since tokens aren't compatible between versions 1/2 and 3
68-
data["authorization_endpoint"] = data["authorization_endpoint"].replace("/v2/o/", "/v3/o/")
69-
data["revocation_endpoint"] = data["revocation_endpoint"].replace("/v2/o/", "/v3/o/")
70-
data["token_endpoint"] = data["token_endpoint"].replace("/v2/o/", "/v3/o/")
71-
data["fhir_metadata_uri"] = data["fhir_metadata_uri"].replace("/v2/fhir/", "/v3/fhir/")
68+
data["authorization_endpoint"] = data.get("authorization_endpoint", "").replace("/v2/o/", "/v3/o/")
69+
data["revocation_endpoint"] = data.get("revocation_endpoint", "").replace("/v2/o/", "/v3/o/")
70+
data["token_endpoint"] = data.get("token_endpoint", "").replace("/v2/o/", "/v3/o/")
71+
data["fhir_metadata_uri"] = data.get("fhir_metadata_uri", "").replace("/v2/fhir/", "/v3/fhir/")
7272

7373
return JsonResponse(data)
7474

hhs_oauth_server/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from apps.accounts.views.oauth2_profile import openidconnect_userinfo
99
from apps.fhir.bluebutton.views.home import fhir_conformance, fhir_conformance_v2
10-
from apps.wellknown.views.openid import smart_configuration
10+
from apps.wellknown.views.openid import smart_configuration, smart_configuration_v3
1111
from hhs_oauth_server.hhs_oauth_server_context import IsAppInstalled
1212
from .views import testobject
1313

@@ -45,7 +45,7 @@ def robots_txt(request):
4545
path("v2/fhir/.well-known/smart-configuration", smart_configuration, name="smart_configuration"),
4646
path("v2/fhir/metadata", fhir_conformance_v2, name="fhir_conformance_metadata_v2"),
4747
path("v2/fhir/", include("apps.fhir.bluebutton.v2.urls")),
48-
path("v3/fhir/.well-known/smart-configuration", smart_configuration, name="smart_configuration_v3"),
48+
path("v3/fhir/.well-known/smart-configuration", smart_configuration_v3, name="smart_configuration_v3"),
4949
path("v3/fhir/metadata", fhir_conformance_v2, name="fhir_conformance_metadata_v3"),
5050
path("v3/fhir/", include("apps.fhir.bluebutton.v3.urls")),
5151
path("v2/o/", include("apps.dot_ext.v2.urls")),

0 commit comments

Comments
 (0)