-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding smart on fhir configuration endpoint #1270
Open
bwang-icf
wants to merge
7
commits into
master
Choose a base branch
from
brandon/BB2-3360-smart-on-fhir
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+52
−1
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c086578
adding smart on fhir configuration endpoint
bwang-icf af7ce06
Merge branch 'master' into brandon/BB2-3360-smart-on-fhir
bwang-icf e585d92
fixing pylint errors
bwang-icf 2b414fb
more fixing of pylint errors
bwang-icf 83109af
removing unnecessary fields for smart configuration response
bwang-icf e5ebec8
fixing url path for smart config v2
bwang-icf 910390d
adding authorize-post to capabilities
bwang-icf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .openid import openid_configuration, base_issuer, build_endpoint_info # NOQA | ||
from .openid import openid_configuration, smart_configuration, base_issuer, build_endpoint_info # NOQA | ||
from .application import ApplicationListView, ApplicationLabelView # NOQA | ||
from .public_applications import ApplicationListView as PublicApplicationListView # NOQA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,17 @@ | |
import apps.logging.request_logger as bb2logging | ||
|
||
logger = logging.getLogger(bb2logging.HHS_SERVER_LOGNAME_FMT.format(__name__)) | ||
SCOPES_SUPPORTED = ["profile", "patient/Patient.read", "patient/ExplanationOfBenefit.read", "patient/Coverage.read"] | ||
CODE_CHALLENGE_METHODS_SUPPORTED = ["S256"] | ||
CAPABILITIES = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add "authorize-post"? looks like that one would also fit within the existing, supported capabilities of BB2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add that now. |
||
"client-confidential-symmetric", | ||
"sso-openid-connect", | ||
"launch-standalone", | ||
"permission-offline", | ||
"permission-patient", | ||
"permission-v1", | ||
"authorize-post" | ||
] | ||
|
||
|
||
@require_GET | ||
|
@@ -23,6 +34,18 @@ def openid_configuration(request): | |
return JsonResponse(data) | ||
|
||
|
||
@require_GET | ||
def smart_configuration(request): | ||
""" | ||
Views that returns smart_configuration. | ||
""" | ||
data = OrderedDict() | ||
issuer = base_issuer(request) | ||
v2 = request.path.endswith('smart-configuration-v2') or request.path.endswith('smartConfigV2') | ||
data = build_smart_config_endpoint(data, issuer=issuer, v2=v2) | ||
return JsonResponse(data) | ||
|
||
|
||
def base_issuer(request): | ||
""" | ||
define the base url for issuer | ||
|
@@ -84,3 +107,26 @@ def build_endpoint_info(data=OrderedDict(), v2=False, issuer=""): | |
data["fhir_metadata_uri"] = issuer + \ | ||
reverse('fhir_conformance_metadata' if not v2 else 'fhir_conformance_metadata_v2') | ||
return data | ||
|
||
|
||
def build_smart_config_endpoint(data=OrderedDict(), v2=False, issuer=""): | ||
""" | ||
construct the smart config endpoint response. Takes in output of build_endpoint_info since they share many fields | ||
issuer should be http: or https:// prefixed url. | ||
|
||
:param data: | ||
:return: | ||
""" | ||
|
||
data = build_endpoint_info(data, issuer=issuer, v2=v2) | ||
del(data["userinfo_endpoint"]) | ||
del(data["ui_locales_supported"]) | ||
del(data["service_documentation"]) | ||
del(data["op_tos_uri"]) | ||
del(data["fhir_metadata_uri"]) | ||
|
||
data["scopes_supported"] = SCOPES_SUPPORTED | ||
data["code_challenge_methods_supported"] = CODE_CHALLENGE_METHODS_SUPPORTED | ||
data["capabilities"] = CAPABILITIES | ||
|
||
return data |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the .well-known/smart-configuration should be relative to the base path of the server, eg v2/fhir/.well-known/smart-configuration for v2, v1/fhir/.well-known/smart-configuration for v1, per environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. I'll have to do a bit more digging around to get it to have that pattern. Would we want to change openid-configuration to follow that pattern as well? It seems like it's the only one to have this current pattern. Swagger link for convenience: https://sandbox.bluebutton.cms.gov/docs/openapi#/v2/openIdConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good team discussion topic. imo the value of a well-known url is that you can automatically discover it. As it stands today, I'd see the same problem for the OIDC config, since openid-configuration-v2 isn't really well-known.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll socialize this with the other engineers and see about making this happen