Skip to content
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

Person json property names #912

Draft
wants to merge 2 commits into
base: feature/signing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,14 +91,14 @@ IWebHostEnvironment env
var useOpenTelemetrySetting = config.GetValue<bool?>("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);
Expand All @@ -111,6 +115,11 @@ IWebHostEnvironment env
services.AddHttpClient<AuthorizationApiClient>();

services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<ISigningNotificationService, SigningNotificationService>();
services.AddSingleton<ISigningService, SigningService>();
services.AddSingleton<ISigningDelegationService, SigningDelegationService>();
services.AddSingleton<IAccessManagementClient, AccessManagementClient>();
services.AddSingleton<IProcessTask, SigningProcessTask>();
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion src/Altinn.App.Api/Models/LookupPersonRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Altinn.App.Api.Models;
using System.Text.Json.Serialization;

namespace Altinn.App.Api.Models;

/// <summary>
/// Data transfer object for the request to search for a person.
Expand All @@ -8,10 +10,12 @@ public class LookupPersonRequest
/// <summary>
/// The social security number of the person to search for.
/// </summary>
[JsonPropertyName("socialSecurityNumber")]
public required string SocialSecurityNumber { get; set; }

/// <summary>
/// The last name of the person to search for.
/// </summary>
[JsonPropertyName("lastName")]
public required string LastName { get; set; }
}
10 changes: 9 additions & 1 deletion src/Altinn.App.Api/Models/LookupPersonResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Altinn.Platform.Register.Models;
using System.Text.Json.Serialization;
using Altinn.Platform.Register.Models;

namespace Altinn.App.Api.Models;

Expand All @@ -22,11 +23,13 @@ public static LookupPersonResponse CreateFromPerson(Person? person)
/// <summary>
/// Indicates whether a person was found or not.
/// </summary>
[JsonPropertyName("success")]
public bool Success { get; init; }

/// <summary>
/// Contains details about the person found by the search. Null if no person was found.
/// </summary>
[JsonPropertyName("personDetails")]
public PersonDetails? PersonDetails { get; init; }
}

Expand All @@ -38,26 +41,31 @@ public class PersonDetails
/// <summary>
/// The social security number
/// </summary>
[JsonPropertyName("ssn")]
public required string Ssn { get; init; }

/// <summary>
/// The full name
/// </summary>
[JsonPropertyName("name")]
public required string Name { get; init; }

/// <summary>
/// The first name
/// </summary>
[JsonPropertyName("firstName")]
public string? FirstName { get; init; }

/// <summary>
/// The middle name
/// </summary>
[JsonPropertyName("middleName")]
public string? MiddleName { get; init; }

/// <summary>
/// The last name
/// </summary>
[JsonPropertyName("lastName")]
public required string LastName { get; init; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -21,7 +22,7 @@ internal sealed class AccessManagementClient(
HttpClient httpClient,
IAppMetadata appMetadata,
IAccessTokenGenerator accessTokenGenerator,
PlatformSettings platformSettings,
IOptions<PlatformSettings> platformSettings,
Telemetry? telemetry = null
) : IAccessManagementClient
{
Expand All @@ -36,7 +37,7 @@ public async Task<DelegationResponse> DelegateRights(DelegationRequest delegatio

HttpResponseMessage? httpResponseMessage = null;
string? httpContent = null;
UrlHelper urlHelper = new(platformSettings);
UrlHelper urlHelper = new(platformSettings.Value);
try
{
var application = await appMetadata.GetApplicationMetadata();
Expand Down
Loading