-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed hl7 fhir client and leveraging health team client * changed to local.appsettings.json * removed FhirOperationException * removed r4 common test proj and made other updates * updated nuget package sources * moved ServiceCollectionExtensions to Microsoft.Health.Extensions.Fhir project * removed unnecessary package references * added service collection extension and updated fhirservice validtor * updated BearerTokenAuthMessageHandler * updating inputs on .net core sdk task * updated r4 params to base constructor * removed updates to ResourceIdentityServiceFactory * updated ResolveResourceIdentityService * refactored repo to service, implemeneted retry and timeout policies on httpclient, updated fhirexceptionprocessor * added fhirclient validation * fix fhirclientvalidator tests * Updated AddFhirClient and corresponding tests * removed identifierextensions and updated validation * added ToSearchQueryParameter to SearchExtensions * added null check for logger in addfhirclient Co-authored-by: Mackenzie Dolishny <[email protected]>
- Loading branch information
1 parent
82f3b26
commit 726cf7d
Showing
43 changed files
with
735 additions
and
550 deletions.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<config> | ||
<add key="repositoryPath" value="packages" /> | ||
</config> | ||
<packageSources> | ||
<!-- When <clear /> is present, previously defined sources are ignored --> | ||
<clear /> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
<add key="Microsoft Health OSS" value="https://microsofthealthoss.pkgs.visualstudio.com/FhirServer/_packaging/Public/nuget/v3/index.json" /> | ||
</packageSources> | ||
<activePackageSource> | ||
<add key="All" value="(Aggregate source)" /> | ||
</activePackageSource> | ||
<disabledPackageSources> | ||
<add key="Microsoft Visual Studio Offline Packages" value="true" /> | ||
</disabledPackageSources> | ||
</configuration> |
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
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
54 changes: 54 additions & 0 deletions
54
src/lib/Microsoft.Health.Extensions.Fhir.R4/BearerTokenAuthorizationMessageHandler.cs
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Azure.Core; | ||
using EnsureThat; | ||
using Microsoft.Health.Common.Telemetry; | ||
using Microsoft.Health.Extensions.Fhir.Telemetry.Metrics; | ||
using Microsoft.Health.Logging.Telemetry; | ||
|
||
namespace Microsoft.Health.Extensions.Fhir | ||
{ | ||
public class BearerTokenAuthorizationMessageHandler : DelegatingHandler | ||
{ | ||
public BearerTokenAuthorizationMessageHandler(Uri uri, TokenCredential tokenCredentialProvider, ITelemetryLogger logger) | ||
{ | ||
TokenCredential = EnsureArg.IsNotNull(tokenCredentialProvider, nameof(tokenCredentialProvider)); | ||
Uri = EnsureArg.IsNotNull(uri, nameof(uri)); | ||
Logger = EnsureArg.IsNotNull(logger, nameof(logger)); | ||
Scopes = new string[] { Uri.ToString().EndsWith(@"/") ? Uri + ".default" : Uri + "/.default" }; | ||
} | ||
|
||
private ITelemetryLogger Logger { get; } | ||
|
||
private TokenCredential TokenCredential { get; } | ||
|
||
private Uri Uri { get; } | ||
|
||
private string[] Scopes { get; } | ||
|
||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | ||
{ | ||
var requestContext = new TokenRequestContext(Scopes); | ||
var accessToken = await TokenCredential.GetTokenAsync(requestContext, cancellationToken); | ||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Token); | ||
var response = await base.SendAsync(request, cancellationToken); | ||
|
||
if (!response.IsSuccessStatusCode) | ||
{ | ||
var statusDescription = response.ReasonPhrase.Replace(" ", string.Empty); | ||
var severity = response.StatusCode == System.Net.HttpStatusCode.TooManyRequests ? ErrorSeverity.Informational : ErrorSeverity.Critical; | ||
Logger.LogMetric(FhirClientMetrics.HandledException($"{ErrorType.FHIRServiceError}{statusDescription}", severity), 1); | ||
} | ||
|
||
return response; | ||
} | ||
} | ||
} |
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
139 changes: 0 additions & 139 deletions
139
src/lib/Microsoft.Health.Extensions.Fhir.R4/FhirClientFactory.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.