Esempio n. 1
0
        public async Task <IActionResult> Token(LoginModel model)
        {
            var identity = await _identityService.GetIdentity(model);

            if (identity == null)
            {
                return(BadRequest("invalid username or password"));
            }

            return(Ok(new
            {
                token = _jwtTokenService.GenerateUserToken(identity.Claims),
                username = identity.Name
            }));
        }