Skip to content

Commit

Permalink
WIP temp add services to make it run
Browse files Browse the repository at this point in the history
  • Loading branch information
cammiida committed Nov 19, 2024
1 parent c0ebaaf commit 0d82c13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
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
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

0 comments on commit 0d82c13

Please sign in to comment.