Saving changes

Using asymmetric validation
This commit is contained in:
Kun Deng
2022-08-13 18:23:03 -04:00
parent f0551a4801
commit 467a9d7e0f
12 changed files with 528 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
namespace Icarus.Models.Shared
{
public class User
{
public string Username { get; set; }
public string Password { get; set; }
public IEnumerable<string> Roles { get; set; }
public IEnumerable<Claim> Claims()
{
var claims = new List<Claim> { new Claim(ClaimTypes.Name, Username) };
claims.AddRange(Roles.Select(role => new Claim(ClaimTypes.Role, role)));
return claims;
}
}
}