public IActionResult CreateToken([FromBody] UsersSinProyectosDto UserAuth)
        {
            //In real example use LoginModel, this is just for dummy purpose so that
            //we can focus on relevant code

            //Comprueba que el body del json es correcto sino devolvera null
            //Si esto ocurre devolveremos un error
            if (UserAuth == null)
            {
                return(BadRequest());
            }

            //Si no cumple con el modelo de creación devuelve error
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //Encriptamos la contraseña
            using (var sha256 = SHA256.Create())
            {
                // Le damos la contraseña
                var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(UserAuth.Password));
                // Recogemos el hash como string
                var hash = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower();
                // Y se lo damos
                UserAuth.Password = hash;
            }

            IActionResult response = Unauthorized();

            if (_usersInfoRespository.UserAuth(UserAuth))
            {
                //create jwt token here and send it with response
                var jwtToken = JwtTokenBuilder();
                response = Ok(new { access_token = jwtToken });
            }

            return(response);
        }
        public IActionResult CreateToken([FromBody] UsersSinProyectosDto UserAuth)
        {
            //In real example use LoginModel, this is just for dummy purpose so that
            //we can focus on relevant code

            //Comprueba que el body del json es correcto sino devolvera null
            //Si esto ocurre devolveremos un error
            if (UserAuth == null)
            {
                return(BadRequest());
            }

            //Si no cumple con el modelo de creación devuelve error
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //Encriptamos la contraseña
            using (var sha256 = SHA256.Create())
            {
                // Le damos la contraseña
                var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(UserAuth.Password));
                // Recogemos el hash como string
                var hash = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower();
                // Y se lo damos
                UserAuth.Password = hash;
            }

            IActionResult response = Unauthorized();

            //string userNombreLargo = IsUserExistsLDAP(UserAuth.Nombre, UserAuth.Password);

            /*string userNombreLargo = UserAuth.Nombre;
             * if (userNombreLargo != null && userNombreLargo != "")
             * {
             *  //Check customer if exists in our database
             *  if (_usersInfoRespository.UserAuth(UserAuth))
             *  {
             *      //create jwt token here and send it with response
             *      var jwtToken = JwtTokenBuilder();
             *      response = Ok(new { access_token = jwtToken, user_long_name = userNombreLargo });
             *  }else{
             *      //Is a new user
             *      this.isNewUser(userNombreLargo, UserAuth.Nombre);
             *      var jwtToken = JwtTokenBuilder();
             *      response = Ok(new { access_token = jwtToken, user_long_name = userNombreLargo});
             *
             *  }
             * }*/
            if (UserAuth.Nombre != null && UserAuth.Nombre != "")
            { //Check customer if exists in our database
                if (_usersInfoRespository.UserAuth(UserAuth))
                {
                    string userNombreLargo = _usersInfoRespository.getNombreCompleto(UserAuth.Nombre);
                    //create jwt token here and send it with response
                    var jwtToken = JwtTokenBuilder();
                    response = Ok(new { access_token = jwtToken, user_long_name = userNombreLargo });
                }
            }
            return(response);
        }