467a9d7e0f
Using asymmetric validation
21 lines
557 B
C#
21 lines
557 B
C#
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;
|
|
}
|
|
}
|
|
} |