|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.common.util.PasswordMaskUtil
public final class PasswordMaskUtil
This is a simple utility class to help keep password values from being printed out, primarily from java.util.Properties object, into MetaMatrix log files. This is not a robust security solution for protecting passwords, and is only good insofar as we get all other code to use this when necessary. When passwords are properly encrypted in the database, this class will be no longer necessary.
This class can be used in one of two ways. First, a Properties object
can be wrapped in an instance of this class - the properties object,
wrapped in this instance, can then be safely sent to LogManager to be
logged, or can otherwise be printed out. This instance will basically
duplicate the toString() method of a normal Properties object, but will
obfuscate any property values whose names end in any of the well-known
password property suffixes
.
The second way is to just use this class's static
doesNameEndWithPasswordSuffix
utility method by hand, passing in a String property name to
see if it ends with any of the well-known
password property suffixes
.
Field Summary | |
---|---|
static java.lang.String |
MASK_STRING
The "mask" String that is printed out of the toString() method, instead of the actual password value. |
static java.lang.String[] |
PASSWORD_PROP_SUFFIXES
The known String suffixes that MetaMatrix property names end in. |
Constructor Summary | |
---|---|
PasswordMaskUtil(java.util.Properties propertiesWithPassword)
A Properties object can be wrapped by this class before, say, being sent to LogManager. |
Method Summary | |
---|---|
static boolean |
doesNameEndWithPasswordSuffix(java.lang.String propName)
Indicates if the String propName ends in any of the well-known password property suffixes . |
java.lang.String |
toString()
This toString() method is basically the same as the java.util.Properties class's toString() method, except that if any of the properties in this class end with any of the well-known password suffixes ,
then the value will
be printed out as MASK_STRING |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] PASSWORD_PROP_SUFFIXES
public static final java.lang.String MASK_STRING
toString()
method, instead of the actual password value.
Constructor Detail |
---|
public PasswordMaskUtil(java.util.Properties propertiesWithPassword)
toString()
method
is called, password properties will be printed out as
a masked string
.
propertiesWithPassword
- Properties object that has
password property values inside itMethod Detail |
---|
public java.lang.String toString()
password suffixes
,
then the value will
be printed out as MASK_STRING
toString
in class java.lang.Object
public static boolean doesNameEndWithPasswordSuffix(java.lang.String propName)
password property suffixes
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |