Add tenant property to user
This commit is contained in:
parent
035da054d6
commit
7bbb8ebfe5
@ -11,6 +11,7 @@ namespace Core.Thalos.BuildingBlocks
|
||||
public UserAdapter? User { get; set; }
|
||||
|
||||
public RoleAdapter? Role { get; set; }
|
||||
public TenantAdapter? Tenant { get; set; }
|
||||
|
||||
public IEnumerable<PermissionAdapter>? Permissions { get; set; }
|
||||
public IEnumerable<ModuleAdapter> Modules { get; set; } = null!;
|
||||
|
||||
@ -64,6 +64,14 @@ namespace Core.Thalos.BuildingBlocks
|
||||
[JsonPropertyName("displayName")]
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tenand ID of the user.
|
||||
/// </summary>
|
||||
[BsonElement("tenantId")]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
[JsonPropertyName("tenantId")]
|
||||
public string TenantId { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the role ID of the user.
|
||||
/// </summary>
|
||||
|
||||
@ -26,7 +26,17 @@ namespace Core.Thalos.BuildingBlocks
|
||||
public const string Id = "id";
|
||||
|
||||
/// <summary>
|
||||
/// Claim name for user's role ID.
|
||||
/// Claim name for user's tenant name.
|
||||
/// </summary>
|
||||
public const string Tenant = "tenant";
|
||||
|
||||
/// <summary>
|
||||
/// Claim name for user's tenant identifier.
|
||||
/// </summary>
|
||||
public const string TenantId = "tenantId";
|
||||
|
||||
/// <summary>
|
||||
/// Claim name for user's role name.
|
||||
/// </summary>
|
||||
public const string Role = "role";
|
||||
|
||||
|
||||
@ -89,6 +89,8 @@ namespace Core.Thalos.BuildingBlocks
|
||||
new Claim(Claims.Name, adapter?.User?.DisplayName ?? string.Empty),
|
||||
new Claim(Claims.GUID, adapter?.User?.Guid ?? string.Empty),
|
||||
new Claim(Claims.Email, adapter?.User?.Email ?? string.Empty),
|
||||
new Claim(Claims.Tenant, adapter?.Tenant?.Name ?? string.Empty),
|
||||
new Claim(Claims.Tenant, adapter?.Tenant?.Id ?? string.Empty),
|
||||
new Claim(Claims.Role, adapter?.Role?.Name ?? string.Empty),
|
||||
new Claim(Claims.RoleId, adapter?.Role?.Id ?? string.Empty),
|
||||
new Claim(Claims.Applications, JsonSerializer.Serialize(adapter?.Role?.Applications), JsonClaimValueTypes.JsonArray),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user