Saving changes
Using asymmetric validation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user