diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs index 324a27c5..f353a346 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs @@ -5,11 +5,6 @@ /// public class PlatformSettings { - /// - /// Gets or sets the access management api endpoint - /// - public string? ApiAccessManagementEndpoint { get; set; } - /// /// Gets or sets the authentication api endpoint /// diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Mocks/Mocks/SystemRegister/SystemRegisterClientMock.cs b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Mocks/Mocks/SystemRegister/SystemRegisterClientMock.cs index 13a8b22a..a4144968 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Mocks/Mocks/SystemRegister/SystemRegisterClientMock.cs +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Mocks/Mocks/SystemRegister/SystemRegisterClientMock.cs @@ -12,28 +12,47 @@ private static async Task> MockTestHelper() { SystemTypeId = "4human_hr_system_2024_2", SystemVendor = "4Human", - Description = "4Humans HR system 2024 versjon." + Description = "4Humans HR system 2024 versjon.", + DefaultRights = + [ + new DefaultRightsDTO { Right = "Sykemelding - Oppgi leder", ServiceProvider = "Arbeids- og velferdsetaten (NAV)" }, + new DefaultRightsDTO { Right = "Søknad om sykepenger", ServiceProvider = "Arbeids- og velferdsetaten (NAV)" } + ] }; RegisteredSystemDTO regsys2 = new() { SystemTypeId = "din_lokale_regnskapspartner", SystemVendor = "Din Lokale Regnskapspartner AS", - Description = "Regnskap og Revisor tjenester" + Description = "Regnskap og Revisor tjenester", + DefaultRights = + [ + new DefaultRightsDTO { Right = "MVA rapportering", ServiceProvider = "Skatteetaten" }, + new DefaultRightsDTO { Right = "Årsregnskap", ServiceProvider = "Skatteetaten" } + ] }; RegisteredSystemDTO regsys3 = new() { SystemTypeId = "fiken_smabedrift", SystemVendor = "Fiken", - Description = "Fiken Småbedrift pakken" + Description = "Fiken Småbedrift pakken", + DefaultRights = + [ + new DefaultRightsDTO { Right = "MVA rapportering", ServiceProvider = "Skatteetaten" }, + new DefaultRightsDTO { Right = "Årsregnskap", ServiceProvider = "Skatteetaten" } + ] }; RegisteredSystemDTO regsys4 = new() { SystemTypeId = "visma_mva_pakke", SystemVendor = "Visma", - Description = "Visma MVA rapportering" + Description = "Visma MVA rapportering", + DefaultRights = + [ + new DefaultRightsDTO { Right = "MVA rapportering", ServiceProvider = "Skatteetaten" } + ] }; @@ -41,7 +60,14 @@ private static async Task> MockTestHelper() { SystemTypeId = "visma_skatt_totalpakke", SystemVendor = "Visma", - Description = "Visma Totalpakke for alle skatterapporterings behov" + Description = "Visma Totalpakke for alle skatterapporterings behov", + DefaultRights = + [ + new DefaultRightsDTO { Right = "MVA rapportering", ServiceProvider = "Skatteetaten" }, + new DefaultRightsDTO { Right = "Årsregnskap", ServiceProvider = "Skatteetaten" }, + new DefaultRightsDTO { Right = "Bytte av Revisor", ServiceProvider = "Skatteetaten" }, + new DefaultRightsDTO { Right = "Levere Lakselus", ServiceProvider = "Mattilsynet" }, + ] }; List theList = new() diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/Extensions/ProgramConfigurationAndDependencyInjection.cs b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/Extensions/ProgramConfigurationAndDependencyInjection.cs index ec139563..5731eccf 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/Extensions/ProgramConfigurationAndDependencyInjection.cs +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/Extensions/ProgramConfigurationAndDependencyInjection.cs @@ -11,9 +11,11 @@ using Altinn.Authentication.UI.Mocks.SystemUsers; using Altinn.Authentication.UI.Mocks.UserProfiles; using Altinn.Common.AccessTokenClient.Services; +using Altinn.Common.PEP.Configuration; using AltinnCore.Authentication.JwtCookie; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.IdentityModel.Tokens; +using System.Configuration; using System.Reflection; namespace Altinn.Authentication.UI.Extensions @@ -47,8 +49,8 @@ public static IServiceCollection ConfigureServiceDefaults(this IServiceCollectio public static IServiceCollection ConfigureAppSettings(this IServiceCollection services, IConfiguration configuration) { //App Configuration - services.Configure(configuration.GetSection("PlatformSettings")); - PlatformSettings? platformSettings = configuration.GetSection("PlatformSettings").Get(); + services.Configure(configuration.GetSection("PlatformSettings")); + Integration.Configuration.PlatformSettings? platformSettings = configuration.GetSection("PlatformSettings").Get(); services.Configure(configuration.GetSection("GeneralSettings")); @@ -61,7 +63,6 @@ public static IServiceCollection ConfigureAppSettings(this IServiceCollection se /// Extension method for Program /// /// - /// /// /// public static IServiceCollection ConfigureAuthenticationAndSecurity(this IServiceCollection services, WebApplicationBuilder builder) @@ -71,11 +72,16 @@ public static IServiceCollection ConfigureAuthenticationAndSecurity(this IServic services.AddTransient(); services.TryAddSingleton(); services.TryAddSingleton(); + + //App Configuration + services.Configure(builder.Configuration.GetSection("PlatformSettings")); + Integration.Configuration.PlatformSettings? platformSettings = builder.Configuration.GetSection("PlatformSettings").Get(); + services.AddAuthentication(JwtCookieDefaults.AuthenticationScheme) .AddJwtCookie(JwtCookieDefaults.AuthenticationScheme, configureOptions: options => { options.JwtCookieName = "AltinnStudioRuntime"; - options.MetadataAddress = "http://localhost:5101/authentication/api/v1/openid/"; + options.MetadataAddress = platformSettings?.OpenIdWellKnownEndpoint; options.TokenValidationParameters = new TokenValidationParameters {