-
Notifications
You must be signed in to change notification settings - Fork 572
SMART on FHIR Token Introspection Endpoint #5257
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
base: main
Are you sure you want to change the base?
Changes from all commits
a23bfe0
fcf508b
6410e8f
e005e0a
afb3e4c
b7b2d53
a9d08c7
fc13cc7
1e03cac
2d77cc8
f977da1
0b6cd2b
5b23a53
4931b4d
5e497a5
a6c28ed
f5e7d63
9567a41
5e7f434
a6ea92d
cbf335a
ad7f161
edc90bb
5cf5776
7ae0d86
63c00b8
28cc5cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ jobs: | |
| numberOfInstances = 2 | ||
| serviceName = $webAppName | ||
| keyVaultName = "${{ parameters.keyVaultName }}".ToLower() | ||
| securityAuthenticationAuthority = "https://login.microsoftonline.com/$(tenant-id)" | ||
| securityAuthenticationAuthority = "https://sts.windows.net/$(tenant-id-guid)" | ||
|
Contributor
Author
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. Our test env has been using an invalid authority for ... not sure how long. I reuse the authority in the OSS service to check the token so I had to fix the authority. |
||
| securityAuthenticationAudience = "${{ parameters.testEnvironmentUrl }}" | ||
| additionalFhirServerConfigProperties = $additionalProperties | ||
| enableAadSmartOnFhirProxy = $true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,40 +38,48 @@ public override async Task OnActionExecutionAsync(ActionExecutingContext context | |
|
|
||
| HttpContext httpContext = context.HttpContext; | ||
|
|
||
| _parametersValidator.CheckPrettyParameter(httpContext); | ||
| _parametersValidator.CheckSummaryParameter(httpContext); | ||
| _parametersValidator.CheckElementsParameter(httpContext); | ||
| await _parametersValidator.CheckRequestedContentTypeAsync(httpContext); | ||
|
|
||
| // If the request is a put or post and has a content-type, check that it's supported | ||
| if (httpContext.Request.Method.Equals(HttpMethod.Post.Method, StringComparison.OrdinalIgnoreCase) || | ||
| httpContext.Request.Method.Equals(HttpMethod.Put.Method, StringComparison.OrdinalIgnoreCase)) | ||
| if (!ShouldIgnoreValidation(httpContext)) | ||
|
Contributor
Author
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. This avoids format validation on token introspection endpoints |
||
| { | ||
| if (httpContext.Request.Headers.TryGetValue(HeaderNames.ContentType, out StringValues headerValue)) | ||
| _parametersValidator.CheckPrettyParameter(httpContext); | ||
| _parametersValidator.CheckSummaryParameter(httpContext); | ||
| _parametersValidator.CheckElementsParameter(httpContext); | ||
| await _parametersValidator.CheckRequestedContentTypeAsync(httpContext); | ||
|
|
||
| // If the request is a put or post and has a content-type, check that it's supported | ||
| if (httpContext.Request.Method.Equals(HttpMethod.Post.Method, StringComparison.OrdinalIgnoreCase) || | ||
| httpContext.Request.Method.Equals(HttpMethod.Put.Method, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| if (!await _parametersValidator.IsFormatSupportedAsync(headerValue[0])) | ||
| if (httpContext.Request.Headers.TryGetValue(HeaderNames.ContentType, out StringValues headerValue)) | ||
| { | ||
| if (!await _parametersValidator.IsFormatSupportedAsync(headerValue[0])) | ||
| { | ||
| throw new UnsupportedMediaTypeException(string.Format(Api.Resources.UnsupportedHeaderValue, headerValue.FirstOrDefault(), HeaderNames.ContentType)); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| throw new UnsupportedMediaTypeException(string.Format(Api.Resources.UnsupportedHeaderValue, headerValue.FirstOrDefault(), HeaderNames.ContentType)); | ||
| // If no content type is supplied, then the server should respond with an unsupported media type exception. | ||
| throw new UnsupportedMediaTypeException(Api.Resources.ContentTypeHeaderRequired); | ||
| } | ||
| } | ||
| else | ||
| else if (httpContext.Request.Method.Equals(HttpMethod.Patch.Method, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| // If no content type is supplied, then the server should respond with an unsupported media type exception. | ||
| throw new UnsupportedMediaTypeException(Api.Resources.ContentTypeHeaderRequired); | ||
| } | ||
| } | ||
| else if (httpContext.Request.Method.Equals(HttpMethod.Patch.Method, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| if (httpContext.Request.Headers.TryGetValue(HeaderNames.ContentType, out StringValues headerValue)) | ||
| { | ||
| if (!await _parametersValidator.IsPatchFormatSupportedAsync(headerValue[0])) | ||
| if (httpContext.Request.Headers.TryGetValue(HeaderNames.ContentType, out StringValues headerValue)) | ||
| { | ||
| throw new UnsupportedMediaTypeException(string.Format(Api.Resources.UnsupportedHeaderValue, headerValue.FirstOrDefault(), HeaderNames.ContentType)); | ||
| if (!await _parametersValidator.IsPatchFormatSupportedAsync(headerValue[0])) | ||
| { | ||
| throw new UnsupportedMediaTypeException(string.Format(Api.Resources.UnsupportedHeaderValue, headerValue.FirstOrDefault(), HeaderNames.ContentType)); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| await base.OnActionExecutionAsync(context, next); | ||
| } | ||
|
|
||
| private static bool ShouldIgnoreValidation(HttpContext httpContext) | ||
| { | ||
| return httpContext.Request.Path.StartsWithSegments("/CustomError", StringComparison.OrdinalIgnoreCase); | ||
| } | ||
| } | ||
| } | ||
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.
needed for E2E tests that use SMART client