Example #1
0
        public async Task <object> LoginUsuarioAsync(
            [FromServices] SigningConfigurations signingConfigurations,
            [FromServices] TokenConfigurations tokenConfigurations,
            [FromBody] UsuarioRequestDto requisicaoLogin)
        {
            try
            {
                var usuario = await _usuarioBusiness.Get(requisicaoLogin);

                if (usuario != null)
                {
                    var result = await _tokenBusiness.LoginUsuario(usuario, signingConfigurations, tokenConfigurations);

                    return(Ok(result));
                }
                else
                {
                    return(StatusCode(403, "Login inválido"));
                }
            }
            catch (Exception ex)
            {
                LogarErro(ex);
                return(StatusCode(500, "Internal server error"));
            }
        }