Esempio n. 1
0
        public JsonResult GetJWT([FromBody] UserInfo user)
        {
            JsonResult categoryJson = null;

            if (AuthHelper.CheckValidUser(user))
            {
                categoryJson = new JsonResult(Model.JWTokenHelper.GenerateJWT(user));
            }
            else
            {
                categoryJson = new JsonResult("Invalid user/password");
            }

            return(categoryJson);
        }
Esempio n. 2
0
        public async Task <JsonResult> GetJWT([FromBody] UserInfo user)
        {
            JsonResult categoryJson = null;

            if (AuthHelper.CheckValidUser(user))
            {
                var jwt = await Tokens.GenerateJwt(user, _jwtFactory, _jwtOptions, new JsonSerializerSettings { Formatting = Formatting.Indented });

                categoryJson = new JsonResult(jwt);
            }
            else
            {
                categoryJson = new JsonResult("Invalid user/password");
            }

            return(categoryJson);
        }