checkCredentials method

  1. @protected
void checkCredentials(
  1. String? username,
  2. String? password
)

Check the username and password validity

Implementation

@protected
void checkCredentials(String? username, String? password) {
  if (username != null) {
    MqttLogger.log("Authenticating with username '{$username}' "
        "and password '{$password}'");
    if (username.trim().length >
        MqttConstants.recommendedMaxUsernamePasswordLength) {
      MqttLogger.log(
          'MqttClient::checkCredentials - Username length (${username.trim().length}) '
          'exceeds the max recommended in the MQTT spec. ');
    }
  }
  if (password != null &&
      password.trim().length >
          MqttConstants.recommendedMaxUsernamePasswordLength) {
    MqttLogger.log(
        'MqttClient::checkCredentials - Password length (${password.trim().length}) '
        'exceeds the max recommended in the MQTT spec. ');
  }
}