From c0ebaaf8deca942eedeac6e975c1782673b9484b Mon Sep 17 00:00:00 2001 From: Camilla Marie Dalan Date: Tue, 19 Nov 2024 13:08:47 +0100 Subject: [PATCH 1/2] adds json propery names for person client --- src/Altinn.App.Api/Models/LookupPersonRequest.cs | 6 +++++- src/Altinn.App.Api/Models/LookupPersonResponse.cs | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Altinn.App.Api/Models/LookupPersonRequest.cs b/src/Altinn.App.Api/Models/LookupPersonRequest.cs index 8ec1a48f0..87fee6e6f 100644 --- a/src/Altinn.App.Api/Models/LookupPersonRequest.cs +++ b/src/Altinn.App.Api/Models/LookupPersonRequest.cs @@ -1,4 +1,6 @@ -namespace Altinn.App.Api.Models; +using System.Text.Json.Serialization; + +namespace Altinn.App.Api.Models; /// /// Data transfer object for the request to search for a person. @@ -8,10 +10,12 @@ public class LookupPersonRequest /// /// The social security number of the person to search for. /// + [JsonPropertyName("socialSecurityNumber")] public required string SocialSecurityNumber { get; set; } /// /// The last name of the person to search for. /// + [JsonPropertyName("lastName")] public required string LastName { get; set; } } diff --git a/src/Altinn.App.Api/Models/LookupPersonResponse.cs b/src/Altinn.App.Api/Models/LookupPersonResponse.cs index 17303674b..e27f1c377 100644 --- a/src/Altinn.App.Api/Models/LookupPersonResponse.cs +++ b/src/Altinn.App.Api/Models/LookupPersonResponse.cs @@ -1,4 +1,5 @@ -using Altinn.Platform.Register.Models; +using System.Text.Json.Serialization; +using Altinn.Platform.Register.Models; namespace Altinn.App.Api.Models; @@ -22,11 +23,13 @@ public static LookupPersonResponse CreateFromPerson(Person? person) /// /// Indicates whether a person was found or not. /// + [JsonPropertyName("success")] public bool Success { get; init; } /// /// Contains details about the person found by the search. Null if no person was found. /// + [JsonPropertyName("personDetails")] public PersonDetails? PersonDetails { get; init; } } @@ -38,26 +41,31 @@ public class PersonDetails /// /// The social security number /// + [JsonPropertyName("ssn")] public required string Ssn { get; init; } /// /// The full name /// + [JsonPropertyName("name")] public required string Name { get; init; } /// /// The first name /// + [JsonPropertyName("firstName")] public string? FirstName { get; init; } /// /// The middle name /// + [JsonPropertyName("middleName")] public string? MiddleName { get; init; } /// /// The last name /// + [JsonPropertyName("lastName")] public required string LastName { get; init; } /// From 0d82c134e9641fc220d4af33195c6f990ba32892 Mon Sep 17 00:00:00 2001 From: Camilla Marie Dalan Date: Tue, 19 Nov 2024 13:10:28 +0100 Subject: [PATCH 2/2] WIP temp add services to make it run --- .../Extensions/ServiceCollectionExtensions.cs | 25 +++++++++++++------ .../AccessManagementClient.cs | 5 ++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs b/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs index a014ed7eb..288268107 100644 --- a/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs +++ b/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs @@ -12,6 +12,10 @@ using Altinn.App.Core.Features; using Altinn.App.Core.Features.Maskinporten; using Altinn.App.Core.Features.Maskinporten.Models; +using Altinn.App.Core.Features.Signing; +using Altinn.App.Core.Features.Signing.Interfaces; +using Altinn.App.Core.Internal.AccessManagement; +using Altinn.App.Core.Internal.Process.ProcessTasks; using Altinn.Common.PEP.Authorization; using Altinn.Common.PEP.Clients; using AltinnCore.Authentication.JwtCookie; @@ -87,14 +91,14 @@ IWebHostEnvironment env var useOpenTelemetrySetting = config.GetValue("AppSettings:UseOpenTelemetry"); // Use Application Insights as default, opt in to use Open Telemetry - if (useOpenTelemetrySetting is true) - { - AddOpenTelemetry(services, config, env); - } - else - { - AddApplicationInsights(services, config, env); - } + // if (useOpenTelemetrySetting is true) + // { + AddOpenTelemetry(services, config, env); + // } + // else + // { + // AddApplicationInsights(services, config, env); + // } AddAuthenticationScheme(services, config, env); AddAuthorizationPolicies(services); @@ -111,6 +115,11 @@ IWebHostEnvironment env services.AddHttpClient(); services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); } /// diff --git a/src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs b/src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs index 7ec52bf49..e0a128d97 100644 --- a/src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs +++ b/src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs @@ -8,6 +8,7 @@ using Altinn.App.Core.Internal.App; using Altinn.Common.AccessTokenClient.Services; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; namespace Altinn.App.Core.Internal.AccessManagement; @@ -21,7 +22,7 @@ internal sealed class AccessManagementClient( HttpClient httpClient, IAppMetadata appMetadata, IAccessTokenGenerator accessTokenGenerator, - PlatformSettings platformSettings, + IOptions platformSettings, Telemetry? telemetry = null ) : IAccessManagementClient { @@ -36,7 +37,7 @@ public async Task DelegateRights(DelegationRequest delegatio HttpResponseMessage? httpResponseMessage = null; string? httpContent = null; - UrlHelper urlHelper = new(platformSettings); + UrlHelper urlHelper = new(platformSettings.Value); try { var application = await appMetadata.GetApplicationMetadata();