Ejemplo n.º 1
0
        public static async void Login(string userCode, string password, Microsoft.AspNetCore.Http.HttpContext httpContext)
        {
            SystemUser systemUser = SystemUserLogic.VerifyLoginAccount(userCode, password);
            var        claims     = new List <Claim> {
                {
                    new Claim("CurrentUser", systemUser.ToJson())
                }
            };

            ClaimsIdentity  claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
            ClaimsPrincipal user           = new ClaimsPrincipal(claimsIdentity);
            await httpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, user);
        }
Ejemplo n.º 2
0
        public static SecurityTokenDescriptor LoginWithApi(string userCode, string password, Microsoft.AspNetCore.Http.HttpContext httpContext)
        {
            SystemUser systemUser = SystemUserLogic.VerifyLoginAccount(userCode, password);

            return(CreateDescriptor(systemUser));
        }