Skip to content

Commit

Permalink
VCST-2048: Use ClaimsPrincipalExtensions GetUserId (#16)
Browse files Browse the repository at this point in the history
feat: Replace custom code with ClaimsPrincipalExtensions that resolves user id and name from IdentityOptions settings.
  • Loading branch information
OlegoO authored Nov 1, 2024
1 parent c7d5a14 commit e53dacf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
Expand Down Expand Up @@ -92,8 +91,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext

private static string GetUserId(AuthorizationHandlerContext context)
{
//PT-5375 use ClaimTypes instead of "name"
return context.User.FindFirstValue("name");
return context.User.GetUserId();
}

private static bool CheckWishlistUserContext(WishlistUserContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.XCart.Core\VirtoCommerce.XCart.Core.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.XCart.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<version>3.812.0</version>
<version-tag></version-tag>

<platformVersion>3.853.0</platformVersion>
<platformVersion>3.861.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Cart" version="3.813.0" />
<dependency id="VirtoCommerce.Inventory" version="3.805.0" />
Expand Down

0 comments on commit e53dacf

Please sign in to comment.