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; + + if (certificates == null) { return null; } - return x5cArray; + _x5cArray = certificates.Select(c => c.ToString()).ToArray()!; + + return _x5cArray; } } diff --git a/Udap.Server/ResponseHandling/UdapTokenResponseGenerator.cs b/Udap.Server/ResponseHandling/UdapTokenResponseGenerator.cs index ac1b80af..bbfc42d0 100644 --- a/Udap.Server/ResponseHandling/UdapTokenResponseGenerator.cs +++ b/Udap.Server/ResponseHandling/UdapTokenResponseGenerator.cs @@ -17,6 +17,8 @@ using Microsoft.Extensions.Logging; using Udap.Server.Validation; using Udap.Util.Extensions; +using Udap.Model; + namespace Udap.Server.ResponseHandling; public class UdapTokenResponseGenerator : TokenResponseGenerator @@ -121,7 +123,7 @@ private void AugmentClaims(Token idToken, ValidatedRequest validationResult) validationResult.Subject!, validationResult.Client, IdentityServerConstants.ProfileDataCallers.UserInfoEndpoint, - new List() { "hl7_identifier" }); + new List() { UdapConstants.JwtClaimTypes.Hl7Identifier }); // context.RequestedResources = validatedResources; _profile.GetProfileDataAsync(context); diff --git a/Udap.Server/Security/Authentication/TieredOAuth/TieredOAuthAuthenticationOptions.cs b/Udap.Server/Security/Authentication/TieredOAuth/TieredOAuthAuthenticationOptions.cs index 6d97b6fd..a7df3c8c 100644 --- a/Udap.Server/Security/Authentication/TieredOAuth/TieredOAuthAuthenticationOptions.cs +++ b/Udap.Server/Security/Authentication/TieredOAuth/TieredOAuthAuthenticationOptions.cs @@ -10,6 +10,8 @@ using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.IdentityModel.Tokens; using System.IdentityModel.Tokens.Jwt; +using IdentityModel; +using Udap.Model; namespace Udap.Server.Security.Authentication.TieredOAuth; @@ -26,11 +28,11 @@ public TieredOAuthAuthenticationOptions() // TokenEndpoint = TieredOAuthAuthenticationDefaults.TokenEndpoint; SignInScheme = TieredOAuthAuthenticationDefaults.AuthenticationScheme; - // DCR at Tiered OAuth only requires these two scopes. - Scope.Add("openid"); - Scope.Add("fhirUser"); - // Scope.Add("email"); - // Scope.Add("profile"); + // TODO: configurable. + Scope.Add(OidcConstants.StandardScopes.OpenId); + // Scope.Add(UdapConstants.StandardScopes.FhirUser); + Scope.Add(OidcConstants.StandardScopes.Email); + Scope.Add(OidcConstants.StandardScopes.Profile); SecurityTokenValidator = _defaultHandler; } diff --git a/_tests/Directory.Packages.props b/_tests/Directory.Packages.props index 8e7342a9..baa0f7e0 100644 --- a/_tests/Directory.Packages.props +++ b/_tests/Directory.Packages.props @@ -5,31 +5,31 @@ - + - - + + - - + + - + - - - - + + + + - + - - + + - + \ No newline at end of file diff --git a/_tests/Udap.Client.System.Tests/IdServerRegistrationTests.cs b/_tests/Udap.Client.System.Tests/IdServerRegistrationTests.cs index 9abf7bd1..328f625c 100644 --- a/_tests/Udap.Client.System.Tests/IdServerRegistrationTests.cs +++ b/_tests/Udap.Client.System.Tests/IdServerRegistrationTests.cs @@ -239,11 +239,11 @@ public async Task RegistrationSuccess_HealthToGo_Test() fhirClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(UdapConstants.TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirClient.GetAsync("https://stage.healthtogo.me:8181/fhir/r4/stage/Patient/1001"); + var patientResponse = await fhirClient.GetAsync("https://stage.healthtogo.me:8181/fhir/r4/stage/Patient/1001"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } @@ -415,11 +415,11 @@ public async Task RegistrationSuccess_HealthGorilla_Test() fhirClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(UdapConstants.TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirClient.GetAsync("https://api-conn.qa.healthgorilla.com/unit/qhin/Patient/1001"); + var patientResponse = await fhirClient.GetAsync("https://api-conn.qa.healthgorilla.com/unit/qhin/Patient/1001"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } @@ -861,12 +861,12 @@ public async Task RegistrationSuccess_client_credentials_FhirLabs_desktop_NoToke fhirLabsClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); + var patientResponse = await fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } @@ -1100,12 +1100,12 @@ public async Task RegistrationSuccess_client_credentials_FhirLabs_desktop_WithTo fhirLabsClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); + var patientResponse = await fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } @@ -1714,11 +1714,11 @@ public async Task RegistrationSuccess_client_credentials_FhirLabs_LIVE_Test() fhirLabsClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirLabsClient.GetAsync("https://fhirlabs.net/fhir/r4/Patient/$count-em"); + var patientResponse = await fhirLabsClient.GetAsync("https://fhirlabs.net/fhir/r4/Patient/$count-em"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } @@ -2128,12 +2128,12 @@ public async Task RegistrationMissingScope_client_credentials_FhirLabs_desktop_T fhirLabsClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(TokenRequestTypes.Bearer, tokenResponse.AccessToken); - var patientResponse = fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); + var patientResponse = await fhirLabsClient.GetAsync("https://localhost:7016/fhir/r4/Patient/$count-em"); - patientResponse.Result.EnsureSuccessStatusCode(); + patientResponse.EnsureSuccessStatusCode(); - _testOutputHelper.WriteLine(await patientResponse.Result.Content.ReadAsStringAsync()); + _testOutputHelper.WriteLine(await patientResponse.Content.ReadAsStringAsync()); } private string BuildHl7B2BExtensions() diff --git a/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerCommunityTest.cs b/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerCommunityTest.cs index e9285aa6..20113b72 100644 --- a/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerCommunityTest.cs +++ b/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerCommunityTest.cs @@ -12,6 +12,7 @@ using System.Security.Claims; using System.Security.Cryptography.X509Certificates; using System.Text.Json; +using System.Text.Json.Nodes; using FluentAssertions; using IdentityModel; using Microsoft.AspNetCore.Hosting; @@ -517,8 +518,8 @@ public async Task signed_metatdataContentTest() issClaim.Value.Should().Be("http://localhost/fhir/r4"); var tokenHeader = jwt.Header; - var x5CArray = JsonSerializer.Deserialize(tokenHeader.X5c); - var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First())); + var x5CArray = tokenHeader["x5c"] as List; + var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First().ToString()!)); var subjectAltName = cert.GetNameInfo(X509NameType.UrlName, false); subjectAltName.Should().Be(issClaim.Value, $"iss: {issClaim.Value} does not match Subject Alternative Name extension"); @@ -529,10 +530,10 @@ public async Task signed_metatdataContentTest() issClaim.Value.Should().BeEquivalentTo(subClaim.Value); var iatClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.IssuedAt); - iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var expClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.Expiration); - expClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + expClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var iat = int.Parse(iatClaim.Value); var exp = int.Parse(expClaim.Value); diff --git a/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerTests.cs b/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerTests.cs index 4a267d02..07405267 100644 --- a/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerTests.cs +++ b/_tests/UdapMetadata.Tests/FhirLabsApi/UdapControllerTests.cs @@ -24,12 +24,10 @@ using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Moq; -using Newtonsoft.Json; using Udap.Client.Client; using Udap.Client.Configuration; using Udap.Common; using Udap.Common.Certificates; -using Udap.Metadata.Server; using Udap.Model; using Udap.Util.Extensions; using Xunit.Abstractions; @@ -381,13 +379,13 @@ public async Task signed_metadataContentTest() var jwt = new JwtSecurityToken(disco.SignedMetadata); var tokenHeader = jwt.Header; - - var x5CArray = JsonConvert.DeserializeObject(tokenHeader.X5c); + + var x5CArray = tokenHeader["x5c"] as List; // bad keys //x5cArray[0] = "MIIFJDCCBAygAwIBAgIIUFnObaPiufEwDQYJKoZIhvcNAQELBQAwgbMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRIwEAYDVQQHDAlTYW4gRGllZ28xEzARBgNVBAoMCkVNUiBEaXJlY3QxPzA9BgNVBAsMNlRlc3QgUEtJIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IChjZXJ0cy5lbXJkaXJlY3QuY29tKTElMCMGA1UEAwwcRU1SIERpcmVjdCBUZXN0IENsaWVudCBTdWJDQTAeFw0yMTAxMTUyMTQ1MTRaFw0yNDAxMTYyMTQ1MTRaMIGlMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTETMBEGA1UECgwKRU1SIERpcmVjdDEzMDEGA1UECwwqVURBUCBUZXN0IENlcnRpZmljYXRlIE5PVCBGT1IgVVNFIFdJVEggUEhJMTcwNQYDVQQDDC5odHRwczovL3N0YWdlLmhlYWx0aHRvZ28ubWU6ODE4MS9maGlyL3I0L3N0YWdlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt9j718Yu8HjoIdSvLTloVLnFLdfdL7T/BylPcIpcKhB7zJvNzZOpq8T/fXhc9b4p6cY6gBPBq1Vnax4zTCAP/te5W6FfoRoKhKqpExuYmgIw0lE8a4UAnHVwPOAvuKS3abGzYfLxxUc4PFXp4HrBx/QWOMqR408GlbSYG0wpeifhMx1VD8TFmU13FmFqgP3cEHjT7RxulfJnPcPPXZ8b5tZIkQMlApJRULVnHEBcICixaRWCJjzzArgoFUydPiAfMZELi80W4n0Wn/WduSYZqwQAosI7AfS3NINd44w8kek1X9WVwX/QtcAVuCXvSFoqoIAa3l4kBCQIHmY9UhltZwIDAQABo4IBRjCCAUIwWQYIKwYBBQUHAQEETTBLMEkGCCsGAQUFBzAChj1odHRwOi8vY2VydHMuZW1yZGlyZWN0LmNvbS9jZXJ0cy9FTVJEaXJlY3RUZXN0Q2xpZW50U3ViQ0EuY3J0MB0GA1UdDgQWBBRZmXqpQzFDSamfvPKiKtjg9gp8cTAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFKOVbWu9K1HN4c/lkG/XJk+/3T7eMEwGA1UdHwRFMEMwQaA/oD2GO2h0dHA6Ly9jZXJ0cy5lbXJkaXJlY3QuY29tL2NybC9FTVJEaXJlY3RUZXN0Q2xpZW50U3ViQ0EuY3JsMA4GA1UdDwEB/wQEAwIHgDA5BgNVHREEMjAwhi5odHRwczovL3N0YWdlLmhlYWx0aHRvZ28ubWU6ODE4MS9maGlyL3I0L3N0YWdlMA0GCSqGSIb3DQEBCwUAA4IBAQAePi+wIAPubt2Fk2jbELZt/bgkc7KTGC5C4sLX25NNYyzvHh0kwmHvgBx3thCv7uOvf/nbmhnk+l3EmgdaB1ZjzcjLMFc7xec9YJWsegzEkR2pzYQp/41cmhTfwNSnXxUSZrBtqInx+mALi9r96lg6RpqQh+DxlToC2vreW7Fy3pFa3DQKFN6j6azYTj5ljqrGprKQRh/iyqRvY+j+BC44Wl+POfBVObwtf71irMuLsSCmMptPGFGTqQdtLYbFjkB4wowiFfEe0PYL+N015iPZA4wimlXbau4XaEvipnIsWxqzT30RbQgrrOw7zN1QjGRURBbdBkMrgLkzmfGxhjuV"; - var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First())); + var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First()?.ToString()!)); var tokenHandler = new JwtSecurityTokenHandler(); @@ -417,10 +415,10 @@ public async Task signed_metadataContentTest() var iatClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.IssuedAt); - iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var expClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.Expiration); - expClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + expClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var iat = int.Parse(iatClaim.Value); var exp = int.Parse(expClaim.Value); diff --git a/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerCommunityTest.cs b/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerCommunityTest.cs index ef14c37c..1e35c090 100644 --- a/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerCommunityTest.cs +++ b/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerCommunityTest.cs @@ -13,6 +13,7 @@ using System.Security.Claims; using System.Security.Cryptography.X509Certificates; using System.Text.Json; +using System.Text.Json.Nodes; using FluentAssertions; using IdentityModel; using Microsoft.AspNetCore.Hosting; @@ -191,8 +192,8 @@ public async Task signed_metatdataContentTest() issClaim.Value.Should().Be("http://localhost/"); var tokenHeader = jwt.Header; - var x5CArray = JsonSerializer.Deserialize(tokenHeader.X5c); - var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First())); + var x5CArray = tokenHeader["x5c"] as List; + var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First().ToString()!)); var subjectAltName = cert.GetNameInfo(X509NameType.UrlName, false); subjectAltName.Should().Be(issClaim.Value, $"iss: {issClaim.Value} does not match Subject Alternative Name extension"); @@ -203,10 +204,10 @@ public async Task signed_metatdataContentTest() issClaim.Value.Should().BeEquivalentTo(subClaim.Value); var iatClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.IssuedAt); - iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var expClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.Expiration); - expClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + expClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var iat = int.Parse(iatClaim.Value); var exp = int.Parse(expClaim.Value); diff --git a/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerTests.cs b/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerTests.cs index 6b03bd1b..3f1fdc24 100644 --- a/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerTests.cs +++ b/_tests/UdapMetadata.Tests/WeatherApi/UdapControllerTests.cs @@ -10,6 +10,7 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Security.Cryptography.X509Certificates; +using System.Text.Json.Nodes; using System.Text.RegularExpressions; using FluentAssertions; using IdentityModel; @@ -23,7 +24,6 @@ using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Moq; -using Newtonsoft.Json; using Udap.Client.Client; using Udap.Client.Configuration; using Udap.Common; @@ -372,13 +372,13 @@ public async Task signed_metatdataContentTest() var jwt = new JwtSecurityToken(disco.SignedMetadata); var tokenHeader = jwt.Header; - var x5CArray = JsonConvert.DeserializeObject(tokenHeader.X5c); + var x5CArray = tokenHeader["x5c"] as List; x5CArray.Should().NotBeNull(); // bad keys //x5cArray[0] = "MIIFJDCCBAygAwIBAgIIUFnObaPiufEwDQYJKoZIhvcNAQELBQAwgbMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRIwEAYDVQQHDAlTYW4gRGllZ28xEzARBgNVBAoMCkVNUiBEaXJlY3QxPzA9BgNVBAsMNlRlc3QgUEtJIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IChjZXJ0cy5lbXJkaXJlY3QuY29tKTElMCMGA1UEAwwcRU1SIERpcmVjdCBUZXN0IENsaWVudCBTdWJDQTAeFw0yMTAxMTUyMTQ1MTRaFw0yNDAxMTYyMTQ1MTRaMIGlMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTETMBEGA1UECgwKRU1SIERpcmVjdDEzMDEGA1UECwwqVURBUCBUZXN0IENlcnRpZmljYXRlIE5PVCBGT1IgVVNFIFdJVEggUEhJMTcwNQYDVQQDDC5odHRwczovL3N0YWdlLmhlYWx0aHRvZ28ubWU6ODE4MS9maGlyL3I0L3N0YWdlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt9j718Yu8HjoIdSvLTloVLnFLdfdL7T/BylPcIpcKhB7zJvNzZOpq8T/fXhc9b4p6cY6gBPBq1Vnax4zTCAP/te5W6FfoRoKhKqpExuYmgIw0lE8a4UAnHVwPOAvuKS3abGzYfLxxUc4PFXp4HrBx/QWOMqR408GlbSYG0wpeifhMx1VD8TFmU13FmFqgP3cEHjT7RxulfJnPcPPXZ8b5tZIkQMlApJRULVnHEBcICixaRWCJjzzArgoFUydPiAfMZELi80W4n0Wn/WduSYZqwQAosI7AfS3NINd44w8kek1X9WVwX/QtcAVuCXvSFoqoIAa3l4kBCQIHmY9UhltZwIDAQABo4IBRjCCAUIwWQYIKwYBBQUHAQEETTBLMEkGCCsGAQUFBzAChj1odHRwOi8vY2VydHMuZW1yZGlyZWN0LmNvbS9jZXJ0cy9FTVJEaXJlY3RUZXN0Q2xpZW50U3ViQ0EuY3J0MB0GA1UdDgQWBBRZmXqpQzFDSamfvPKiKtjg9gp8cTAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFKOVbWu9K1HN4c/lkG/XJk+/3T7eMEwGA1UdHwRFMEMwQaA/oD2GO2h0dHA6Ly9jZXJ0cy5lbXJkaXJlY3QuY29tL2NybC9FTVJEaXJlY3RUZXN0Q2xpZW50U3ViQ0EuY3JsMA4GA1UdDwEB/wQEAwIHgDA5BgNVHREEMjAwhi5odHRwczovL3N0YWdlLmhlYWx0aHRvZ28ubWU6ODE4MS9maGlyL3I0L3N0YWdlMA0GCSqGSIb3DQEBCwUAA4IBAQAePi+wIAPubt2Fk2jbELZt/bgkc7KTGC5C4sLX25NNYyzvHh0kwmHvgBx3thCv7uOvf/nbmhnk+l3EmgdaB1ZjzcjLMFc7xec9YJWsegzEkR2pzYQp/41cmhTfwNSnXxUSZrBtqInx+mALi9r96lg6RpqQh+DxlToC2vreW7Fy3pFa3DQKFN6j6azYTj5ljqrGprKQRh/iyqRvY+j+BC44Wl+POfBVObwtf71irMuLsSCmMptPGFGTqQdtLYbFjkB4wowiFfEe0PYL+N015iPZA4wimlXbau4XaEvipnIsWxqzT30RbQgrrOw7zN1QjGRURBbdBkMrgLkzmfGxhjuV"; - var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First())); + var cert = new X509Certificate2(Convert.FromBase64String(x5CArray!.First().ToString()!)); var tokenHandler = new JwtSecurityTokenHandler(); tokenHandler.ValidateToken(disco.SignedMetadata, new TokenValidationParameters @@ -406,10 +406,10 @@ public async Task signed_metatdataContentTest() var iatClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.IssuedAt); - iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + iatClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var expClaim = jwt.Payload.Claims.Single(c => c.Type == JwtClaimTypes.Expiration); - expClaim.ValueType.Should().Be(ClaimValueTypes.Integer); + expClaim.ValueType.Should().Be(ClaimValueTypes.Integer64); var iat = int.Parse(iatClaim.Value); var exp = int.Parse(expClaim.Value); diff --git a/_tests/UdapServer.Tests/Conformance/Tiered/TieredOauthTests.cs b/_tests/UdapServer.Tests/Conformance/Tiered/TieredOauthTests.cs index a485d0d0..1136583b 100644 --- a/_tests/UdapServer.Tests/Conformance/Tiered/TieredOauthTests.cs +++ b/_tests/UdapServer.Tests/Conformance/Tiered/TieredOauthTests.cs @@ -254,7 +254,7 @@ private void BuildUdapIdentityProvider(X509Certificate2 sureFhirLabsAnchor, X509 }); _mockIdPPipeline.IdentityScopes.Add(new IdentityResources.OpenId()); - _mockIdPPipeline.IdentityScopes.Add(new IdentityResources.Profile()); + _mockIdPPipeline.IdentityScopes.Add(new UdapIdentityResources.Profile()); _mockIdPPipeline.IdentityScopes.Add(new UdapIdentityResources.Udap()); _mockIdPPipeline.IdentityScopes.Add(new IdentityResources.Email()); _mockIdPPipeline.IdentityScopes.Add(new UdapIdentityResources.FhirUser()); @@ -590,7 +590,7 @@ public async Task ClientAuthorize_IdPDiscovery_IdPRegistration_IdPAuthAccess_Cli "mailto:Joseph.Shook@Surescripts.com", "mailto:JoeShook@gmail.com" }) .WithTokenEndpointAuthMethod(UdapConstants.RegistrationDocumentValues.TokenEndpointAuthMethodValue) - .WithScope("udap openid fhirUser user/*.read") + .WithScope("udap openid user/*.read") .WithResponseTypes(new List { "code" }) .WithRedirectUrls(new List { "https://code_client/callback" }) .Build(); diff --git a/_tests/UdapServer.Tests/IntegrationRegistrationTests.cs b/_tests/UdapServer.Tests/IntegrationRegistrationTests.cs index 227fb4d0..68ef4078 100644 --- a/_tests/UdapServer.Tests/IntegrationRegistrationTests.cs +++ b/_tests/UdapServer.Tests/IntegrationRegistrationTests.cs @@ -267,8 +267,8 @@ public async Task UdapDynamicClientRegistrationDocumentCompareToJwtPayloadTest() signingCredentials); var signedSoftwareStatement = string.Concat(encodedHeader, ".", encodedPayloadJwt, ".", encodedSignature); - JsonExtensions.SerializeToJson(jwtPayload).Should() - .BeEquivalentTo(JsonExtensions.SerializeToJson(document)); + jwtPayload.SerializeToJson().Should() + .BeEquivalentTo(JsonSerializer.Serialize(document)); encodedPayloadJwt.Should().BeEquivalentTo(encodedPayload); @@ -504,8 +504,8 @@ public async Task redirect_uris_Tests() //With and without authorization_code in signingCredentials); var signedSoftwareStatement = string.Concat(encodedHeader, ".", encodedPayloadJwt, ".", encodedSignature); - JsonExtensions.SerializeToJson(jwtPayload).Should() - .BeEquivalentTo(JsonExtensions.SerializeToJson(document)); + jwtPayload.SerializeToJson().Should() + .BeEquivalentTo(JsonSerializer.Serialize(document)); encodedPayloadJwt.Should().BeEquivalentTo(encodedPayload); @@ -545,7 +545,7 @@ public void TestSerialization() _testOutputHelper.WriteLine(documentSerialized); var docDeserialized = - JsonExtensions.DeserializeFromJson(documentSerialized); + JsonSerializer.Deserialize(documentSerialized); // var docDeserialized = JsonSerializer.Deserialize(documentSerialized); _testOutputHelper.WriteLine(docDeserialized.RedirectUris.First()); diff --git a/examples/Directory.Packages.props b/examples/Directory.Packages.props index ff0ea1b2..4e322227 100644 --- a/examples/Directory.Packages.props +++ b/examples/Directory.Packages.props @@ -9,17 +9,17 @@ - + - - - - + + + + diff --git a/examples/FhirLabsApi/FhirLabsApi.csproj b/examples/FhirLabsApi/FhirLabsApi.csproj index a226d743..c9d724d8 100644 --- a/examples/FhirLabsApi/FhirLabsApi.csproj +++ b/examples/FhirLabsApi/FhirLabsApi.csproj @@ -43,11 +43,12 @@ - - + + - - + + + diff --git a/examples/FhirLabsApi/Program.cs b/examples/FhirLabsApi/Program.cs index 794379d5..f0ef30c4 100644 --- a/examples/FhirLabsApi/Program.cs +++ b/examples/FhirLabsApi/Program.cs @@ -19,6 +19,7 @@ using IdentityModel; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Extensions.Options; +using Microsoft.IdentityModel.Logging; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; @@ -63,10 +64,10 @@ builder.Services .UseFhirServerController( /*systemService,*/ options => { - options.OutputFormatters.Add(new SystemTextJsonOutputFormatter(new JsonSerializerOptions())); // An example HTML formatter that puts the raw XML on the output options.OutputFormatters.Add(new SimpleHtmlFhirOutputFormatter()); // need this to serialize udap metadata because UseFhirServerController clears OutputFormatters + options.OutputFormatters.Add(new SystemTextJsonOutputFormatter(new JsonSerializerOptions())); }) .AddNewtonsoftJson(options => { @@ -86,7 +87,7 @@ { options.Authority = builder.Configuration["Jwt:Authority"]; options.RequireHttpsMetadata = bool.Parse(builder.Configuration["Jwt:RequireHttpsMetadata"] ?? "true"); - + options.TokenValidationParameters = new TokenValidationParameters { diff --git a/examples/Udap.Auth.Server.Admin/Udap.Auth.Server.Admin.csproj b/examples/Udap.Auth.Server.Admin/Udap.Auth.Server.Admin.csproj index 65c38f32..1bb42e9c 100644 --- a/examples/Udap.Auth.Server.Admin/Udap.Auth.Server.Admin.csproj +++ b/examples/Udap.Auth.Server.Admin/Udap.Auth.Server.Admin.csproj @@ -13,13 +13,13 @@ - - - - + + + + - - + + diff --git a/examples/Udap.Auth.Server/Dockerfile b/examples/Udap.Auth.Server/Dockerfile index 9abe526e..69b44b87 100644 --- a/examples/Udap.Auth.Server/Dockerfile +++ b/examples/Udap.Auth.Server/Dockerfile @@ -5,6 +5,8 @@ WORKDIR /app EXPOSE 8080 EXPOSE 443 COPY SureFhirLabs_CA.cer /etc/ssl/certs +#Troubleshoot proxy traffic to Touchstone +COPY ngnix-proxy-TestCA.cer /etc/ssl/certs RUN update-ca-certificates FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build diff --git a/examples/Udap.Auth.Server/Dockerfile.gcp b/examples/Udap.Auth.Server/Dockerfile.gcp index 31c1f171..78d8c44d 100644 --- a/examples/Udap.Auth.Server/Dockerfile.gcp +++ b/examples/Udap.Auth.Server/Dockerfile.gcp @@ -5,8 +5,11 @@ WORKDIR /app EXPOSE 8080 EXPOSE 443 COPY SureFhirLabs_CA.cer /etc/ssl/certs +COPY ngnix-proxy-TestCA.cer /etc/ssl/certs RUN update-ca-certificates + + FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src diff --git a/examples/Udap.Auth.Server/Program.cs b/examples/Udap.Auth.Server/Program.cs index 125ddb21..78dd94ab 100644 --- a/examples/Udap.Auth.Server/Program.cs +++ b/examples/Udap.Auth.Server/Program.cs @@ -48,6 +48,20 @@ var app = builder .ConfigureServices(args) .ConfigurePipeline(args); + + // + // Created to route traffic through AEGIS Touchstone via a Nginx reverse proxy in my cloud environment. + // Touchstone is also a proxy used to surveil traffic for testing and certification. + // + if (Environment.GetEnvironmentVariable("proxy-hosts") != null) + { + var hostMaps = Environment.GetEnvironmentVariable("proxy-hosts")?.Split(";"); + foreach (var hostMap in hostMaps!) + { + Log.Information($"Adding host map: {hostMap}"); + File.AppendAllText("/etc/hosts", hostMap + Environment.NewLine); + } + } app.Run(); } diff --git a/examples/Udap.Auth.Server/Udap.Auth.Server.csproj b/examples/Udap.Auth.Server/Udap.Auth.Server.csproj index f8b07bd8..ac95c56e 100644 --- a/examples/Udap.Auth.Server/Udap.Auth.Server.csproj +++ b/examples/Udap.Auth.Server/Udap.Auth.Server.csproj @@ -8,28 +8,28 @@ . Linux - -p "5002:443" -e ASPNETCORE_HTTPS_PORT=7016 + -p "5002:443" false c6e8001f-5e75-4d7b-ab8b-f2a9c535f777 - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - - - + + + + diff --git a/examples/Udap.Auth.Server/appsettings.Development.json b/examples/Udap.Auth.Server/appsettings.Development.json index 781b479f..cac7b723 100644 --- a/examples/Udap.Auth.Server/appsettings.Development.json +++ b/examples/Udap.Auth.Server/appsettings.Development.json @@ -65,7 +65,7 @@ "IdPBaseUrl": "https://udap.zimt.work/oauth2/aus5wvee13EWm169M1d7", "IssuedCerts": [ { - "FilePath": "CertStore/issued/udap-sandbox-surescripts.p12", + "FilePath": "CertStore/issued/udap-sandbox-surescripts-2.p12", "Password": "secrets.json" } ] diff --git a/examples/Udap.Auth.Server/cloudbuild.yaml b/examples/Udap.Auth.Server/cloudbuild.yaml index 44a39c8d..23b42689 100644 --- a/examples/Udap.Auth.Server/cloudbuild.yaml +++ b/examples/Udap.Auth.Server/cloudbuild.yaml @@ -1,7 +1,7 @@ steps: # Build the container image - name: 'gcr.io/cloud-builders/docker' - args: [ 'build', '-t', 'us-west1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/udap.auth.server:$TAG_NAME', '--file', './Dockerfile', '.' ] + args: [ 'build', '-t', 'us-west1-docker.pkg.dev/$PROJECT_ID/cloud-run-source-deploy/udap.auth.server:$TAG_NAME', '--file', './Dockerfile.gcp', '.' ] # See:: https://cloud.google.com/build/docs/deploying-builds/deploy-cloud-run # Push the container image to Container Registry diff --git a/examples/Udap.CA/Udap.CA.csproj b/examples/Udap.CA/Udap.CA.csproj index bef6b760..0ee0b8a8 100644 --- a/examples/Udap.CA/Udap.CA.csproj +++ b/examples/Udap.CA/Udap.CA.csproj @@ -13,17 +13,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/examples/Udap.Identity.Provider.2/Udap.Identity.Provider.2.csproj b/examples/Udap.Identity.Provider.2/Udap.Identity.Provider.2.csproj index e09b8bd4..a13b30ac 100644 --- a/examples/Udap.Identity.Provider.2/Udap.Identity.Provider.2.csproj +++ b/examples/Udap.Identity.Provider.2/Udap.Identity.Provider.2.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -19,21 +19,21 @@ - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - - - + + + + diff --git a/examples/Udap.Identity.Provider/Udap.Identity.Provider.csproj b/examples/Udap.Identity.Provider/Udap.Identity.Provider.csproj index b9074e6e..58c70b9e 100644 --- a/examples/Udap.Identity.Provider/Udap.Identity.Provider.csproj +++ b/examples/Udap.Identity.Provider/Udap.Identity.Provider.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -19,21 +19,21 @@ - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - - - + + + + diff --git a/examples/clients/UdapEd/Client/UdapEd.Client.csproj b/examples/clients/UdapEd/Client/UdapEd.Client.csproj index 641e559b..f63baad3 100644 --- a/examples/clients/UdapEd/Client/UdapEd.Client.csproj +++ b/examples/clients/UdapEd/Client/UdapEd.Client.csproj @@ -18,11 +18,11 @@ - - + + - + diff --git a/examples/clients/UdapEd/Directory.Packages.props b/examples/clients/UdapEd/Directory.Packages.props index faf581b5..16998834 100644 --- a/examples/clients/UdapEd/Directory.Packages.props +++ b/examples/clients/UdapEd/Directory.Packages.props @@ -19,7 +19,7 @@ - + \ No newline at end of file diff --git a/examples/clients/UdapEd/Server/Controllers/AccessController.cs b/examples/clients/UdapEd/Server/Controllers/AccessController.cs index 457ac7b2..39545198 100644 --- a/examples/clients/UdapEd/Server/Controllers/AccessController.cs +++ b/examples/clients/UdapEd/Server/Controllers/AccessController.cs @@ -129,9 +129,9 @@ public Task RequestAccessTokenClientCredentials( var b2bHl7 = new B2BAuthorizationExtension() { SubjectId = "urn:oid:2.16.840.1.113883.4.6#1234567890", - OrganizationId = new Uri("https://fhirlabs.net/fhir/r4"), + OrganizationId = new Uri("https://fhirlabs.net/fhir/r4").OriginalString, OraganizationName = "FhirLabs", - PurposeOfUse = new HashSet + PurposeOfUse = new List { "urn:oid:2.16.840.1.113883.5.8#TREAT" } diff --git a/examples/clients/UdapEd/Server/UdapEd.Server.csproj b/examples/clients/UdapEd/Server/UdapEd.Server.csproj index 26987157..610e9c30 100644 --- a/examples/clients/UdapEd/Server/UdapEd.Server.csproj +++ b/examples/clients/UdapEd/Server/UdapEd.Server.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -19,18 +19,18 @@ - - - + + + - + - - - + + + diff --git a/examples/clients/UdapEd/Shared/UdapEd.Shared.csproj b/examples/clients/UdapEd/Shared/UdapEd.Shared.csproj index 11a723e3..aba56ad2 100644 --- a/examples/clients/UdapEd/Shared/UdapEd.Shared.csproj +++ b/examples/clients/UdapEd/Shared/UdapEd.Shared.csproj @@ -29,7 +29,7 @@ - + diff --git a/migrations/UdapDb.SqlServer/SeedData.Auth.Server.cs b/migrations/UdapDb.SqlServer/SeedData.Auth.Server.cs index 98c9308a..2383e4ad 100644 --- a/migrations/UdapDb.SqlServer/SeedData.Auth.Server.cs +++ b/migrations/UdapDb.SqlServer/SeedData.Auth.Server.cs @@ -418,6 +418,9 @@ public static async Task EnsureSeedData(string connectionString, string cer await configDbContext.SaveChangesAsync(); } + // + // fhirUser + // if (configDbContext.IdentityResources.All(i => i.Name != UdapConstants.StandardScopes.FhirUser)) { var fhirUserIdentity = new UdapIdentityResources.FhirUser(); @@ -442,7 +445,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/SeedData.Identity.Provider.cs b/migrations/UdapDb.SqlServer/SeedData.Identity.Provider.cs index fc0a157a..2895351e 100644 --- a/migrations/UdapDb.SqlServer/SeedData.Identity.Provider.cs +++ b/migrations/UdapDb.SqlServer/SeedData.Identity.Provider.cs @@ -256,7 +256,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/SeedData.Identity.Provider2.cs b/migrations/UdapDb.SqlServer/SeedData.Identity.Provider2.cs index f9a8e183..39058319 100644 --- a/migrations/UdapDb.SqlServer/SeedData.Identity.Provider2.cs +++ b/migrations/UdapDb.SqlServer/SeedData.Identity.Provider2.cs @@ -197,7 +197,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/Seed_GCP_Auth_Server.cs b/migrations/UdapDb.SqlServer/Seed_GCP_Auth_Server.cs index 671d221c..fedee787 100644 --- a/migrations/UdapDb.SqlServer/Seed_GCP_Auth_Server.cs +++ b/migrations/UdapDb.SqlServer/Seed_GCP_Auth_Server.cs @@ -234,6 +234,9 @@ public static async Task EnsureSeedData(string connectionString, string cer await configDbContext.SaveChangesAsync(); } + // + // fhirUser + // if (configDbContext.IdentityResources.All(i => i.Name != UdapConstants.StandardScopes.FhirUser)) { var fhirUserIdentity = new UdapIdentityResources.FhirUser(); @@ -258,7 +261,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/Seed_GCP_Idp1.cs b/migrations/UdapDb.SqlServer/Seed_GCP_Idp1.cs index 8d0ba10c..4e156872 100644 --- a/migrations/UdapDb.SqlServer/Seed_GCP_Idp1.cs +++ b/migrations/UdapDb.SqlServer/Seed_GCP_Idp1.cs @@ -132,6 +132,9 @@ public static async Task EnsureSeedData(string connectionString, string cer await configDbContext.SaveChangesAsync(); } + // + // fhirUser + // if (configDbContext.IdentityResources.All(i => i.Name != UdapConstants.StandardScopes.FhirUser)) { var fhirUserIdentity = new UdapIdentityResources.FhirUser(); @@ -156,7 +159,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/Seed_GCP_Idp2.cs b/migrations/UdapDb.SqlServer/Seed_GCP_Idp2.cs index 728e1cee..3d1873a9 100644 --- a/migrations/UdapDb.SqlServer/Seed_GCP_Idp2.cs +++ b/migrations/UdapDb.SqlServer/Seed_GCP_Idp2.cs @@ -224,6 +224,9 @@ public static async Task EnsureSeedData(string connectionString, string cer await configDbContext.SaveChangesAsync(); } + // + // fhirUser + // if (configDbContext.IdentityResources.All(i => i.Name != UdapConstants.StandardScopes.FhirUser)) { var fhirUserIdentity = new UdapIdentityResources.FhirUser(); @@ -248,7 +251,7 @@ public static async Task EnsureSeedData(string connectionString, string cer // if (configDbContext.IdentityResources.All(i => i.Name != IdentityServerConstants.StandardScopes.Profile)) { - var identityResource = new IdentityResources.Profile(); + var identityResource = new UdapIdentityResources.Profile(); configDbContext.IdentityResources.Add(identityResource.ToEntity()); await configDbContext.SaveChangesAsync(); diff --git a/migrations/UdapDb.SqlServer/UdapDb.SqlServer.csproj b/migrations/UdapDb.SqlServer/UdapDb.SqlServer.csproj index 017a60e4..c56ea8a9 100644 --- a/migrations/UdapDb.SqlServer/UdapDb.SqlServer.csproj +++ b/migrations/UdapDb.SqlServer/UdapDb.SqlServer.csproj @@ -11,13 +11,13 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +