Class Password

java.lang.Object
  extended byPassword

public class Password
extends Object

Model a good password.

A password is a String satisfying the following conditions (close to those required of Unix passwords, according to the man passwd command in Unix):


A password string may be stored in a Password object only in encrypted form.


Constructor Summary
Password(String password, String notSubstringOf, String doesNotContain)
          Construct a new Password.
 
Method Summary
static void main(String[] args)
          Unit test for Password objects.
 void match(String guess)
          See whether a supplied guess matches this password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Password

public Password(String password,
                String notSubstringOf,
                String doesNotContain)
         throws BadPasswordException
Construct a new Password.

Parameters:
password - the new password.
notSubstringOf - a String that may not contain the password.
doesNotContain - a String the password may not contain.
Throws:
BadPasswordException - when password is unacceptable.
Method Detail

main

public static void main(String[] args)
Unit test for Password objects.


match

public void match(String guess)
           throws BadPasswordException
See whether a supplied guess matches this password.

Parameters:
guess - the trial password.
Throws:
BadPasswordException - when match fails.