Test Autentification 20230216
This commit is contained in:
30
TestApp02/Data/BiudAuthService.cs
Normal file
30
TestApp02/Data/BiudAuthService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace TestApp02.Data
|
||||
{
|
||||
public class BiudAuthService
|
||||
{
|
||||
public BiudAuthService() {
|
||||
Users = new Dictionary<string, ClaimsPrincipal> ();
|
||||
}
|
||||
public Dictionary<string, ClaimsPrincipal> Users { get; set; }
|
||||
|
||||
public ClaimsPrincipal AuthenticateUser(string p_LoginUser, string p_PasswordUser)
|
||||
{
|
||||
|
||||
//ClaimsIdentity _ClaimsIdentity = new ClaimsIdentity();
|
||||
|
||||
List<Claim> _Claims = new List<Claim>{
|
||||
new Claim(ClaimTypes.Name, p_LoginUser),
|
||||
new Claim("Surname", "Surname"),
|
||||
new Claim ("Firstname", "Firstname"),
|
||||
new Claim ("Middlename", "Middlename"),
|
||||
new Claim ("Raion", "raion")
|
||||
};
|
||||
ClaimsIdentity _ClaimsIdentity = new ClaimsIdentity(_Claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(_ClaimsIdentity);
|
||||
return claimsPrincipal;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user