|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.davesag.generica.util.PasswordGenerator
Generates a single use 'random' password based on concatenating a verb and a noun and then transliterating some letters to numbers at random. This is quite suitable for emailing a new password to a user who has forgotten their password, and then requiring that they change their password.
| Field Summary | |
protected static PasswordGenerator |
THE_PASS_GEN
the singleton password generator |
protected static Random |
THE_RANDOM
the random number generator |
protected String[] |
theNouns
an array of nouns |
protected String[] |
theVerbs
an array of verbs |
| Constructor Summary | |
protected |
PasswordGenerator()
Null constructor. |
| Method Summary | |
static String[] |
buildWordArray(MessageResources messages,
String name)
Builds an array of words from a supplied resource and name. |
String |
generatePassword()
Generates a randowm password based on concatanation of a verb, a noun, some numbers and so forth. |
static PasswordGenerator |
getPasswordGenerator()
Gets the default passwrod generator. |
static PasswordGenerator |
getPasswordGenerator(String resource)
Gets a password generator if one has not already been made, using the resources in the path supplied. |
Random |
getRandom()
gets the singleton Random number generator if it exists, or seeds and makes one if not. |
void |
setNouns(String[] nouns)
sets the array of nouns. |
void |
setVerbs(String[] verbs)
sets the array of verbs. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static PasswordGenerator THE_PASS_GEN
protected static Random THE_RANDOM
protected String[] theVerbs
protected String[] theNouns
| Constructor Detail |
protected PasswordGenerator()
getPasswordGenerator to return an instance of this.
| Method Detail |
public static PasswordGenerator getPasswordGenerator()
public static PasswordGenerator getPasswordGenerator(String resource)
resource - The fully qualified path to a resource file.
public void setVerbs(String[] verbs)
verbs - The array of verbs.public void setNouns(String[] nouns)
nouns - The array of nouns.public Random getRandom()
public String generatePassword()
public static String[] buildWordArray(MessageResources messages,
String name)
messages - The resource file with the words in it.name - The name of the comma delimited list of words to use.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||