public static Map<String, String> maskPasswordInPropertyMap(Map<String, String> propertyMap) {
    if (null == propertyMap) {
      return null;
    }
    final Map<String, String> maskedMap = new HashMap<>();
    for (Map.Entry<String, String> property : propertyMap.entrySet()) {
      String value = isPassword(property.getKey()) ? secretPrefix : property.getValue();
      maskedMap.put(property.getKey(), value);
    }
    return maskedMap;
  }
Helper function to mask a string of properties that may contain a property with a password.
@param propertyMap Property map to mask by replacing any passwords with the text "SECRET"
@return a new map with the passwords masked, or null if the <code>propertyMap</code> is null.
ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java