diff --git a/Directory.Packages.props b/Directory.Packages.props
index 7781f35d..104518cc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -8,22 +8,22 @@
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
@@ -33,18 +33,18 @@
-
+
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/Udap.Client/Rest/FhirClientWithUrlProvider.cs b/Udap.Client/Rest/FhirClientWithUrlProvider.cs
index 678e4564..851f997d 100644
--- a/Udap.Client/Rest/FhirClientWithUrlProvider.cs
+++ b/Udap.Client/Rest/FhirClientWithUrlProvider.cs
@@ -10,12 +10,8 @@ namespace Udap.Client.Rest;
public class FhirClientWithUrlProvider : FhirClient
{
public FhirClientWithUrlProvider(IBaseUrlProvider baseUrlProvider, HttpClient httpClient, FhirClientSettings? settings = null, IStructureDefinitionSummaryProvider? provider = null)
- : base(baseUrlProvider.GetBaseUrl(), httpClient, settings, provider)
+ : base(baseUrlProvider.GetBaseUrl(), httpClient, settings)
{
- var requester = new HttpClientRequester(baseUrlProvider.GetBaseUrl(), Settings, httpClient);
- Requester = requester;
-
- // Expose default request headers to user.
- RequestHeaders = requester.Client.DefaultRequestHeaders;
+
}
}
diff --git a/Udap.Model/Registration/UdapCertificationAndEndorsementDocument.cs b/Udap.Model/Registration/UdapCertificationAndEndorsementDocument.cs
index acb1723f..26cb5dd1 100644
--- a/Udap.Model/Registration/UdapCertificationAndEndorsementDocument.cs
+++ b/Udap.Model/Registration/UdapCertificationAndEndorsementDocument.cs
@@ -9,6 +9,7 @@
using System;
using System.IdentityModel.Tokens.Jwt;
+using System.Text.Json;
using System.Text.Json.Serialization;
using IdentityModel;
using Microsoft.IdentityModel.Tokens;
@@ -249,17 +250,15 @@ public UdapCertificationAndEndorsementDocument(string certificationName)
/// Serializes this instance to JSON.
///
/// This instance as JSON.
- /// Use to customize JSON serialization.
public virtual string SerializeToJson()
{
- return JsonExtensions.SerializeToJson(this);
+ return JsonSerializer.Serialize(this);
}
///
/// Encodes this instance as Base64UrlEncoded JSON.
///
/// Base64UrlEncoded JSON.
- /// Use to customize JSON serialization.
public virtual string Base64UrlEncode()
{
return Base64UrlEncoder.Encode(SerializeToJson());
diff --git a/Udap.Model/Registration/UdapDynamicClientRegistrationDocument.cs b/Udap.Model/Registration/UdapDynamicClientRegistrationDocument.cs
index 3aa6d8de..585eae81 100644
--- a/Udap.Model/Registration/UdapDynamicClientRegistrationDocument.cs
+++ b/Udap.Model/Registration/UdapDynamicClientRegistrationDocument.cs
@@ -625,7 +625,7 @@ internal IList GetIListClaims(string claimType)
}
else
{
- claimValues.Add(JsonExtensions.SerializeToJson(value));
+ claimValues.Add(JsonSerializer.Serialize(value));
}
return claimValues;
@@ -647,7 +647,7 @@ internal IList GetIListClaims(string claimType)
}
}
- return JsonExtensions.SerializeToJson(value);
+ return JsonSerializer.Serialize(value);
}
return null;
@@ -715,17 +715,15 @@ internal static object GetClaimValueUsingValueType(Claim claim)
/// Serializes this instance to JSON.
///
/// This instance as JSON.
- /// Use to customize JSON serialization.
public virtual string SerializeToJson()
{
- return JsonExtensions.SerializeToJson(this);
+ return JsonSerializer.Serialize(this);
}
///
/// Encodes this instance as Base64UrlEncoded JSON.
///
/// Base64UrlEncoded JSON.
- /// Use to customize JSON serialization.
public virtual string Base64UrlEncode()
{
return Base64UrlEncoder.Encode(SerializeToJson());
diff --git a/Udap.Model/UdapAuthenticationExtensions/B2BAuthorizationExtension.cs b/Udap.Model/UdapAuthenticationExtensions/B2BAuthorizationExtension.cs
index 99c5089d..97a6d6a0 100644
--- a/Udap.Model/UdapAuthenticationExtensions/B2BAuthorizationExtension.cs
+++ b/Udap.Model/UdapAuthenticationExtensions/B2BAuthorizationExtension.cs
@@ -24,7 +24,7 @@ public class B2BAuthorizationExtension : Dictionary
private string? _subjectId;
private string? _subjectRole;
private string? _organizationName;
- private Uri _organizationId = default!;
+ private string? _organizationId = default!;
private ICollection _purposeOfUse = new HashSet();
private ICollection? _consentPolicy;
private ICollection? _consentReference;
@@ -104,13 +104,13 @@ public string? OraganizationName
}
[JsonPropertyName(UdapConstants.B2BAuthorizationExtension.OrganizationId)]
- public Uri OrganizationId
+ public string? OrganizationId
{
get
{
- if (Uri.TryCreate(GetStandardClaim(UdapConstants.RegistrationDocumentValues.ClientUri), UriKind.Absolute, out var value))
+ if (_organizationId == null)
{
- _organizationId = value;
+ _organizationId = GetStandardClaim(UdapConstants.B2BAuthorizationExtension.OrganizationId);
}
return _organizationId;
@@ -118,7 +118,7 @@ public Uri OrganizationId
set
{
_organizationId = value;
- this[UdapConstants.B2BAuthorizationExtension.OrganizationId] = value;
+ if (value != null) this[UdapConstants.B2BAuthorizationExtension.OrganizationId] = value;
}
}
@@ -210,7 +210,7 @@ internal IList GetIListClaims(string claimType)
}
else
{
- claimValues.Add(JsonExtensions.SerializeToJson(value));
+ claimValues.Add(JsonSerializer.Serialize(value));
}
return claimValues;
@@ -231,7 +231,7 @@ internal IList GetIListClaims(string claimType)
}
}
- return JsonExtensions.SerializeToJson(value);
+ return JsonSerializer.Serialize(value);
}
return null;
diff --git a/Udap.Model/UdapConstants.cs b/Udap.Model/UdapConstants.cs
index 7eed6ad1..d4ed3715 100644
--- a/Udap.Model/UdapConstants.cs
+++ b/Udap.Model/UdapConstants.cs
@@ -187,7 +187,7 @@ public static class B2BAuthorizationExtension
public static class JwtClaimTypes
{
public static string Extensions = "extensions";
- public static string FhirUser = "hl7_identifier";
+ public static string Hl7Identifier = "hl7_identifier";
}
public static class TokenRequest
diff --git a/Udap.Server/Models/UdapIdentityResources.cs b/Udap.Server/Models/UdapIdentityResources.cs
index d24ad1d0..cabfc434 100644
--- a/Udap.Server/Models/UdapIdentityResources.cs
+++ b/Udap.Server/Models/UdapIdentityResources.cs
@@ -30,7 +30,32 @@ public FhirUser()
Name = UdapConstants.StandardScopes.FhirUser;
DisplayName = "FHIR resource representation of the current user.";
Required = false;
- UserClaims.Add("hl7_identifier");
+ UserClaims.Add(UdapConstants.JwtClaimTypes.Hl7Identifier);
+ }
+ }
+
+ ///
+ /// Models the standard openid scope
+ ///
+ ///
+ public class Profile : IdentityResource
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Profile()
+ {
+ var profile = new IdentityResources.Profile();
+ Name = profile.Name;
+ DisplayName = profile.DisplayName;
+ Required = profile.Required;
+ UserClaims = profile.UserClaims;
+ //
+ // Ensure HL7Identifier is included in the profile scope when the profile scope is requested
+ // http://build.fhir.org/ig/HL7/fhir-identity-matching-ig/digital-identity.html
+ // http://hl7.org/fhir/smart-app-launch/1.0.0/scopes-and-launch-context/index.html
+ //
+ UserClaims.Add(UdapConstants.JwtClaimTypes.Hl7Identifier);
}
}
diff --git a/Udap.Server/Registration/UdapDynamicClientRegistrationValidator.cs b/Udap.Server/Registration/UdapDynamicClientRegistrationValidator.cs
index c809a58c..a1a83fc8 100644
--- a/Udap.Server/Registration/UdapDynamicClientRegistrationValidator.cs
+++ b/Udap.Server/Registration/UdapDynamicClientRegistrationValidator.cs
@@ -18,18 +18,14 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Cryptography.X509Certificates;
using System.Text;
-using System.Text.Json;
using Duende.IdentityServer.Models;
using Duende.IdentityServer.Services;
-using Hl7.Fhir.Utility;
using IdentityModel;
-using IdentityModel.Client;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Tokens;
-using Newtonsoft.Json.Linq;
using Udap.Common;
using Udap.Common.Certificates;
using Udap.Common.Extensions;
@@ -648,7 +644,7 @@ private bool ValidateChain(
return false;
}
- private readonly string[]? _x5cArray = null;
+ private string[]? _x5cArray = null;
//Todo duplicate code
private string[]? Getx5c(JwtHeader jwtHeader)
@@ -660,13 +656,15 @@ private bool ValidateChain(
return null;
}
- var x5cArray = JsonSerializer.Deserialize(jwtHeader.X5c);
-
- if (x5cArray != null && !x5cArray.Any())
+ var certificates = jwtHeader["x5c"] as List