Browse Source

DATAMONGO-601 - Fixed exposing password by MongoDbUtils.

MongoDbUtils is now not exposing the plain password in the exception message piped into CannotGetMongoDbConnectionException but uses the newly introduced toString() method of UserCredentials (see DATACMNS-275).
pull/24/head
Oliver Gierke 13 years ago
parent
commit
c807b2abcf
  1. 4
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java

4
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java

@ -112,8 +112,8 @@ public abstract class MongoDbUtils { @@ -112,8 +112,8 @@ public abstract class MongoDbUtils {
String password = credentials.hasPassword() ? credentials.getPassword() : null;
if (!db.authenticate(username, password == null ? null : password.toCharArray())) {
throw new CannotGetMongoDbConnectionException("Failed to authenticate to database [" + databaseName
+ "], username = [" + username + "], password = [" + password + "]", databaseName, credentials);
throw new CannotGetMongoDbConnectionException("Failed to authenticate to database [" + databaseName + "], "
+ credentials.toString(), databaseName, credentials);
}
}
}

Loading…
Cancel
Save