Skip to content

Commit

Permalink
better logging for access management issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HauklandJ committed Dec 19, 2024
1 parent c4b4ef2 commit a962424
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Altinn.App.Core.Internal.AccessManagement.Models;
using Altinn.App.Core.Internal.App;
using Altinn.Common.AccessTokenClient.Services;
using Microsoft.AspNetCore.Http;

Check failure on line 10 in src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs

View workflow job for this annotation

GitHub Actions / Static code analysis

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 10 in src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (macos-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 10 in src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (macos-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 10 in src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 10 in src/Altinn.App.Core/Internal/AccessManagement/AccessManagementClient.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

Expand Down Expand Up @@ -68,6 +70,28 @@ public async Task<DelegationResponse> DelegateRights(DelegationRequest delegatio
}
else
{
try
{
var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(httpContent);
if (problemDetails is not null)
{
logger.LogError(
"Got error status code for access management request. Status code: {StatusCode}. Problem details: {ProblemDetails}",
httpResponseMessage.StatusCode,
problemDetails
);
throw new AccessManagementRequestException(
"Got error status code for access management request.",
problemDetails,
httpResponseMessage.StatusCode,
httpContent
);
}
}
catch (JsonException)
{
response = null;
}
throw new HttpRequestException("Got error status code for access management request.");
}
return response;
Expand Down

0 comments on commit a962424

Please sign in to comment.