do not log full password

This commit is contained in:
Peter Hormanns 2017-09-19 21:16:53 +02:00
parent a696ddfc31
commit b353e00b6c
2 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.logging.Logger;
import de.hsadmin.core.util.Config;
import de.hsadmin.core.util.TextUtil;
public class JDBCProcessor extends AbstractProcessor {
@ -48,7 +49,7 @@ public class JDBCProcessor extends AbstractProcessor {
throw new ProcessorException("database admin-user configuration failed");
}
}
LOG.info("process() - DB-User: " + user + " Password: " + password);
LOG.info("process() - DB-User: " + user + " Password: " + TextUtil.hidePassword(password));
try {
Class.forName(driver);
c = DriverManager.getConnection(url, user, password);

View File

@ -76,4 +76,12 @@ public class TextUtil {
return parsedValue;
}
public static synchronized String hidePassword(String passwd) {
StringBuffer val = new StringBuffer(passwd.substring(0, 2));
for (int i = 2; i < passwd.length(); i++) {
val.append('*');
}
return val.toString();
}
}