Skip to content

Commit

Permalink
Re-add APIM key auth, handle possible index out of range exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
elsand committed Mar 11, 2024
1 parent 2a2c474 commit 1c14d42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static DialogSearchAuthorizationResult CreateDialogSearchResponse(

for (var i = 0; i < xamlJsonRequestRoot.Request.MultiRequests.RequestReference.Count; i++)
{
if (xamlJsonResponse.Response[i].Decision != PermitResponse)
if (i >= xamlJsonResponse.Response.Count || xamlJsonResponse.Response[i].Decision != PermitResponse)
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
x => x.ClientSettings.ExhangeToAltinnToken = true)
.ConfigureHttpClient((services, client) =>
{
client.BaseAddress = services.GetRequiredService<IOptions<InfrastructureSettings>>().Value.Altinn.BaseUri;
var altinnSettings = services.GetRequiredService<IOptions<InfrastructureSettings>>().Value.Altinn;
client.BaseAddress = altinnSettings.BaseUri;
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", altinnSettings.SubscriptionKey);
})
// TODO! Add cache policy based on request body
.AddPolicyHandlerFromRegistry(PollyPolicy.DefaultHttpRetryPolicy);
Expand Down

0 comments on commit 1c14d42

Please sign in to comment.