diff --git a/src/Altinn.App.Api/Controllers/AuthorizationController.cs b/src/Altinn.App.Api/Controllers/AuthorizationController.cs index 528a63a54..e658e5732 100644 --- a/src/Altinn.App.Api/Controllers/AuthorizationController.cs +++ b/src/Altinn.App.Api/Controllers/AuthorizationController.cs @@ -66,7 +66,7 @@ public async Task GetCurrentParty(bool returnPartyObject = false) // Now we know the user can't represent the selected party (reportee) // so we will automatically switch to the user's own party (from the profile) var reportee = details.Profile.Party; - if (user.CookiePartyId is null || user.CookiePartyId.Value != reportee.PartyId) + if (user.SelectedPartyId is null || user.SelectedPartyId.Value != reportee.PartyId) { // Setting cookie to partyID of logged in user if it varies from previus value. Response.Cookies.Append( diff --git a/src/Altinn.App.Core/Internal/Auth/IAuthenticationContext.cs b/src/Altinn.App.Core/Internal/Auth/IAuthenticationContext.cs index 32e1d69dd..7fbd53867 100644 --- a/src/Altinn.App.Core/Internal/Auth/IAuthenticationContext.cs +++ b/src/Altinn.App.Core/Internal/Auth/IAuthenticationContext.cs @@ -62,9 +62,9 @@ public sealed record User : AuthenticationInfo public int PartyId { get; } /// - /// Party ID from party ID selection cookie + /// The party the user has selected through party selection /// - public int? CookiePartyId { get; } + public int? SelectedPartyId { get; } /// /// Authentication level @@ -82,7 +82,7 @@ internal User( int userId, int partyId, int authenticationLevel, - int? cookiePartyId, + int? selectedPartyId, string token, Func> getUserProfile, Func> lookupParty, @@ -95,7 +95,7 @@ Func> getApplicationMetadata { UserId = userId; PartyId = partyId; - CookiePartyId = cookiePartyId; + SelectedPartyId = selectedPartyId; AuthenticationLevel = authenticationLevel; _getUserProfile = getUserProfile; _lookupParty = lookupParty; diff --git a/test/Altinn.App.Api.Tests/Controllers/InstancesController_PostNewInstanceTests.cs b/test/Altinn.App.Api.Tests/Controllers/InstancesController_PostNewInstanceTests.cs index 9bd7ee08d..8b85ff055 100644 --- a/test/Altinn.App.Api.Tests/Controllers/InstancesController_PostNewInstanceTests.cs +++ b/test/Altinn.App.Api.Tests/Controllers/InstancesController_PostNewInstanceTests.cs @@ -162,7 +162,6 @@ public async Task PostNewInstance_Simplified(TestJwtToken token) string app = "permissive-app"; int instanceOwnerPartyId = token.PartyId; using HttpClient client = GetRootedClient(org, app); - // string token = TestAuthentication.GetUserToken(userId: 1337, partyId: instanceOwnerPartyId); var createResponseParsed = await CreateInstanceSimplified(org, app, instanceOwnerPartyId, client, token.Token); var instanceId = createResponseParsed.Id;