Пример #1
0
        public IActionResult Excute()
        {
            //Customer login = new Customer();

            //login.UserName = CustomerLogin.UserName;
            //login.Password = CustomerLogin.Password;

            IActionResult response = new UnauthorizedResult();

            Customer customer = SecurityUtils.AuthenticateCustomer(CustomerLogin);

            if (customer != null)
            {
                var tokenStr = SecurityUtils.GenerateJSONWebToken(customer);
                response = new OkObjectResult(new { token = tokenStr, user = customer });
            }
            else
            {
                //return StatusCode(403);
                return(new StatusCodeResult(403));
            }

            return(response);
        }