Skip to content

Commit

Permalink
Update v7 with latest from main (#475)
Browse files Browse the repository at this point in the history
* chore(deps): update nuget non-major dependencies (#397)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update actions/cache action to v4 (#407)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update nuget non-major dependencies (#450)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add forwarded header which contains client's ipaddress (#445)

Co-authored-by: acn-dgopa <acn-dgopa@dev-acn-tje-14>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dhanalakshmi Gopalswamy <[email protected]>
Co-authored-by: acn-dgopa <acn-dgopa@dev-acn-tje-14>
  • Loading branch information
4 people authored Mar 5, 2024
1 parent f9b6aaa commit abe0e38
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-and-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
Expand Down
2 changes: 1 addition & 1 deletion src/Altinn.App.Api/Altinn.App.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Altinn.Common.PEP" Version="1.3.0" />
<PackageReference Include="Altinn.Common.PEP" Version="1.4.0" />
<PackageReference Include="Altinn.Platform.Storage.Interface" Version="3.24.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.1.1" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Altinn.App.Core/Altinn.App.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<PackageReference Include="Altinn.ApiClients.Maskinporten" Version="7.1.0" />
<PackageReference Include="Altinn.Common.AccessTokenClient" Version="1.1.5" />
<PackageReference Include="Altinn.Common.EFormidlingClient" Version="1.3.3" />
<PackageReference Include="Altinn.Common.PEP" Version="1.3.0" />
<PackageReference Include="Altinn.Platform.Models" Version="1.2.0" />
<PackageReference Include="Altinn.Common.PEP" Version="1.4.0" />
<PackageReference Include="Altinn.Platform.Models" Version="1.4.0" />
<PackageReference Include="Altinn.Platform.Storage.Interface" Version="3.24.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.57" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.59" />
<PackageReference Include="JWTCookieAuthentication" Version="3.0.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Net.Http;
using System.Net.Http.Headers;
using Altinn.App.Core.Configuration;
using Altinn.App.Core.Constants;
using Altinn.App.Core.Extensions;
using Altinn.App.Core.Interface;
using Altinn.Authorization.ABAC.Xacml.JsonProfile;
using Altinn.Platform.Register.Models;

using AltinnCore.Authentication.Utils;
Expand All @@ -24,6 +26,7 @@ public class AuthorizationClient : IAuthorization
private readonly AppSettings _settings;
private readonly HttpClient _client;
private readonly ILogger _logger;
private const string ForwardedForHeaderName = "x-forwarded-for";

/// <summary>
/// Initializes a new instance of the <see cref="AuthorizationClient"/> class
Expand All @@ -44,6 +47,12 @@ public AuthorizationClient(
_settings = settings.CurrentValue;
_logger = logger;
httpClient.BaseAddress = new Uri(platformSettings.Value.ApiAuthorizationEndpoint);

if (!httpClient.DefaultRequestHeaders.Contains(ForwardedForHeaderName))
{
string? clientIpAddress = _httpContextAccessor?.HttpContext?.Request?.Headers?[ForwardedForHeaderName];
httpClient.DefaultRequestHeaders.Add(ForwardedForHeaderName, clientIpAddress);
}
httpClient.DefaultRequestHeaders.Add(General.SubscriptionKeyHeaderName, platformSettings.Value.SubscriptionKey);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
_client = httpClient;
Expand Down
10 changes: 5 additions & 5 deletions test/Altinn.App.Api.Tests/Altinn.App.Api.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.25" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.27" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions test/Altinn.App.Common.Tests/Altinn.App.Common.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions test/Altinn.App.Core.Tests/Altinn.App.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit abe0e38

Please sign in to comment.