mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:46:30 +00:00
fixed inference bugs
add DONE during inference, correct handling on C# side
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Security.Claims;
|
||||
using MessagePack;
|
||||
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
@@ -8,4 +9,18 @@ public class User
|
||||
[Key("i")]public string Id { get; set; }
|
||||
[Key("e")]public string Email { get; set; }
|
||||
[Key("r")]public RoleEnum Role { get; set; }
|
||||
|
||||
//For deserializing
|
||||
public User(){}
|
||||
|
||||
public User(IEnumerable<Claim> claims)
|
||||
{
|
||||
var claimDict = claims.ToDictionary(x => x.Type, x => x.Value);
|
||||
|
||||
Id = claimDict[SecurityConstants.CLAIM_NAME_ID];
|
||||
Email = claimDict[SecurityConstants.CLAIM_EMAIL];
|
||||
if (!Enum.TryParse(claimDict[SecurityConstants.CLAIM_ROLE], out RoleEnum role))
|
||||
role = RoleEnum.None;
|
||||
Role = role;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user