Skip to content

Commit

Permalink
VCST-2048: Use ClaimsPrincipalExtensions GetUserId (#437)
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 d123c64 commit c4798ce
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\VirtoCommerce.OrdersModule.Core\VirtoCommerce.OrdersModule.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.817.0" />
<PackageReference Include="VirtoCommerce.NotificationsModule.Core" Version="3.809.0" />
<PackageReference Include="VirtoCommerce.PaymentModule.Core" Version="3.804.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.ShippingModule.Core" Version="3.802.0" />
<PackageReference Include="VirtoCommerce.StoreModule.Core" Version="3.809.0" />
<PackageReference Include="VirtoCommerce.SearchModule.Core" Version="3.804.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.OrdersModule.Data\VirtoCommerce.OrdersModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.OrdersModule.Data\VirtoCommerce.OrdersModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.OrdersModule.Data\VirtoCommerce.OrdersModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.822.0" />
<PackageReference Include="VirtoCommerce.InventoryModule.Core" Version="3.805.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.853.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.OrdersModule.Core\VirtoCommerce.OrdersModule.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext
{
//Use associated to user memberId and userId as only fall-back value to check "OnlyOrderResponsibleScope" auth rule
var memberId = context.User.FindFirstValue(MemberIdClaimType);
var userId = context.User.FindFirstValue(ClaimTypes.NameIdentifier) ?? context.User.FindFirstValue("name");
var userId = context.User.GetUserId();
memberId = string.IsNullOrEmpty(memberId) ? null : memberId;
userId = string.IsNullOrEmpty(userId) ? null : userId;

Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.OrdersModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<version>3.833.0</version>
<version-tag />

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

0 comments on commit c4798ce

Please sign in to comment.