Ejemplo n.º 1
0
        public IActionResult Excute()
        {
            //Admin login = new Admin();

            //login.UserName = admin.UserName;
            //login.Password = admin.Password;

            IActionResult response = Unauthorized();

            Admin admin = SecurityUtils.AuthenticateAdmin(AdminLogin);

            if (admin != null)
            {
                var tokenStr = SecurityUtils.GenerateJSONWebToken(admin);
                response = Ok(new { token = tokenStr, user = admin });
            }
            else
            {
                return(StatusCode(403));
            }
            return(response);
        }