예제 #1
0
        public async Task <ActionResult> Authenticate(
            [FromBody] LoginRequest model,
            [FromServices] IAccessManager accessManager)
        {
            var token = await accessManager.ForgeTokenAsync(model.Username, model.Password);

            if (token is null)
            {
                return(BadRequest("User or password invalid"));
            }

            return(Ok(new { token }));
        }