Skip to content

Commit

Permalink
VCST-2048: Use ClaimsPrincipalExtensions GetUserId (#124)
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 b11b7ac commit e88dc6a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="VirtoCommerce.CartModule.Core" Version="3.810.0" />
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.TaxModule.Core" Version="3.800.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.QuoteModule.Data\VirtoCommerce.QuoteModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<noWarn>NU1903</noWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.QuoteModule.Data\VirtoCommerce.QuoteModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.861.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.QuoteModule.Data\VirtoCommerce.QuoteModule.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.861.0" />
<PackageReference Include="VirtoCommerce.ShippingModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.StoreModule.Core" Version="3.800.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ private async Task<Contact> GetContact(string userId)

private static string GetUserId(AuthorizationHandlerContext context)
{
return
context.User.FindFirstValue(ClaimTypes.NameIdentifier) ??
context.User.FindFirstValue("name") ??
AnonymousUser.UserName;
return context.User.GetUserId() ?? AnonymousUser.UserName;
}
}
2 changes: 1 addition & 1 deletion src/VirtoCommerce.QuoteModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<version>3.818.0</version>
<version-tag />

<platformVersion>3.841.0</platformVersion>
<platformVersion>3.861.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Assets" version="3.800.0" />
<dependency id="VirtoCommerce.Cart" version="3.810.0" />
Expand Down

0 comments on commit e88dc6a

Please sign in to comment.