Adding tenant_id to claims, so that it can be retrieved from HttpContext.User
This commit is contained in:
parent
48e795fda2
commit
069baa2aad
@ -106,6 +106,11 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Services
|
||||
if (!string.IsNullOrWhiteSpace(user.ZipCode))
|
||||
claims.Add(new Claim("address_zip_code", user.ZipCode));
|
||||
|
||||
if (user.TenantId != 0)
|
||||
{
|
||||
claims.Add(new Claim("tenant_id", user.TenantId.ToString()));
|
||||
}
|
||||
|
||||
if (_userManager.SupportsUserEmail)
|
||||
{
|
||||
claims.AddRange(new[]
|
||||
|
@ -95,7 +95,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||
{
|
||||
var user = _appUserParser.Parse(HttpContext.User);
|
||||
|
||||
|
||||
var vm = await _orderSvc.GetMyOrders(user);
|
||||
|
||||
if (user.TenantId == 1)
|
||||
|
@ -33,7 +33,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
||||
SecurityNumber = claims.Claims.FirstOrDefault(x => x.Type == "card_security_number")?.Value ?? "",
|
||||
State = claims.Claims.FirstOrDefault(x => x.Type == "address_state")?.Value ?? "",
|
||||
Street = claims.Claims.FirstOrDefault(x => x.Type == "address_street")?.Value ?? "",
|
||||
ZipCode = claims.Claims.FirstOrDefault(x => x.Type == "address_zip_code")?.Value ?? ""
|
||||
ZipCode = claims.Claims.FirstOrDefault(x => x.Type == "address_zip_code")?.Value ?? "",
|
||||
TenantId = int.Parse(claims.Claims.FirstOrDefault(x => x.Type == "tenant_id")?.Value ?? "0")
|
||||
};
|
||||
}
|
||||
throw new ArgumentException(message: "The principal must be a ClaimsPrincipal", paramName: nameof(principal));
|
||||
|
Loading…
x
Reference in New Issue
Block a user