示例#1
0
        public JsonWebToken Post([FromBody] User userLogin)
        {
            var user = _logic.ValidateUser(userLogin.Email, userLogin.Password);

            if (user == null)
            {
                throw new UnauthorizedAccessException();
            }

            var token = new JsonWebToken
            {
                Access_Token = _tokenProvider.CreationToken(user, DateTime.UtcNow.AddHours(8)),
                Expires_in   = 480//minutes
            };

            return(token);
        }