public Task ValidateConnectionAsync(
            MqttConnectionValidatorContext context)
        {
            var currentUser = _repo.GetUser(context.Username);

            if (currentUser == null)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                LogMessage(context);
                return(Task.CompletedTask);
            }

            if (context.Username != currentUser.Username)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                LogMessage(context);
                return(Task.CompletedTask);
            }

            if (context.Password != currentUser.Password)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                LogMessage(context);
                return(Task.CompletedTask);
            }

            context.ReasonCode = MqttConnectReasonCode.Success;
            LogMessage(context);
            return(Task.CompletedTask);
        }
        public async Task ValidateConnectionAsync(
            MqttConnectionValidatorContext context)
        {
            var currentUser = _repo.GetUser(context.Username);

            if (currentUser == null)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                await LogMessage(context);

                return;
            }

            if (context.Username != currentUser.Username)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                await LogMessage(context);

                return;
            }

            if (context.Password != currentUser.Password)
            {
                context.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                await LogMessage(context);

                return;
            }

            context.ReasonCode = MqttConnectReasonCode.Success;
            //_repo.
            await LogMessage(context, true);

            return;
        }