All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.preferences.PrefFieldPassWord

java.lang.Object
   |
   +----semper.preferences.PrefField
           |
           +----semper.preferences.PrefFieldPassWord

public class PrefFieldPassWord
extends PrefField
implements ActionListener
This class defines fields representing passwords. A password field appears as a button in preferences groups. Once the button is selected the user can change the passphrase in a different window. In order to do so, the user must show that he knows the actual value of the password.

Version:
$Revision: 1.12 $ $Date: 1997/11/21 13:47:31 $
Author:
Louis Salvail
See Also:
PrefFieldLabel, PrefFieldChoice, PrefFieldNegotiable, PrefFieldCheckBox, PrefFieldString

Variable Index

 o _algo
 o BUTTON_PREFIX
 o internalLayout
 o maximum_length
 o minimum_length
 o panel
 o StandardDefaultPassWord

Constructor Index

 o PrefFieldPassWord()
Constructor used by new Instance when internalizing this object.
 o PrefFieldPassWord(String, String)
Constructor for password field with default constraints and password.
 o PrefFieldPassWord(String, String, String)
Constructor for password field with default constraints.
 o PrefFieldPassWord(String, String, String, GridBagConstraints)
Constructor for password field with guenuine constraints.

Method Index

 o actionPerformed(ActionEvent)
This is the method responsible to launch the password change thread when password button is pushed.
 o applyModification()
Apply the change to the actual password value if it isOK().
 o cancel()
This method forget the user's changes.
 o getBytesValue()
The same as Object getValue() but returning an array of bytes directly.
 o getHashingFunction()
Returns the selected hashing function.
 o getMessage()
Returns the message that will be displayed when the password is given by the user for the first time.
 o getPasswordName()
Returns the name for this password.
 o getValue()
Returns the hashing value of the password.
 o isEqual(String)
Returns true if this password has the same hashing value than the one given as input.
 o isModified()
Indicates of the user has changed the password.
 o isOK()
Returns true if the new value of the password is correct.
 o setHashingFunction(HashingAlgorithm)
Set the hashing function h such that that passphrase s is stored and tested with h(s).
 o setMessage(String)
Sets the message explaining why this password is used.
 o setPassPhraseForChange(Object)
Schedules a new passphrase.
 o setPassPhraseForChange(String)
Same as setPassPhraseForChange(Object newval) but with a string as argument.
 o setValue(Object)
Sets the hashing value of the passphrase by specifying the hashing value.
 o setValue(String)
Sets the hashing value of the passphrase by specifying the passphrase itself.
 o showme(PrefFrame)
Shows the password button in a PrefFrame.

Variables

 o BUTTON_PREFIX
 public static final String BUTTON_PREFIX
 o _algo
 public HashingAlgorithm _algo
 o panel
 public PrefPanel panel
 o internalLayout
 public FlowLayout internalLayout
 o StandardDefaultPassWord
 public static final String StandardDefaultPassWord
 o minimum_length
 public int minimum_length
 o maximum_length
 public int maximum_length

Constructors

 o PrefFieldPassWord
 public PrefFieldPassWord(String passWordName,
                          String fieldName)
Constructor for password field with default constraints and password. The password is set initially to the StandardDefaultPassWord.

Parameters:
passWordName - is the name of that password which will appear on the button label in the preferences group.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
Returns:
the new object.
 o PrefFieldPassWord
 public PrefFieldPassWord(String passWordName,
                          String fieldName,
                          String initialValue)
Constructor for password field with default constraints.

Parameters:
passWordName - is the name of that password which will appear on the button label in the preferences group.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
initialValue - is the initial password string.
 o PrefFieldPassWord
 public PrefFieldPassWord(String passWordName,
                          String fieldName,
                          String initialValue,
                          GridBagConstraints constraints)
Constructor for password field with guenuine constraints. The passphrase is not set and then has still to be specified.

Parameters:
passWordName - is the name of that password and also the name of that field.
fieldName - is the field name for this password. This is the string by which this field can be obtained by PrefGroup.get(fieldName).
initialValue - is the initial password string.
constraints - is the set of GridBagConstraints for that component. The internal constraints representation is a clone of the input.
Returns:
the new object.
See Also:
GridBagConstraints
 o PrefFieldPassWord
 public PrefFieldPassWord()
Constructor used by new Instance when internalizing this object. Othwerwise, should not be used.

Returns:
the new empty field.

Methods

 o getPasswordName
 public String getPasswordName()
Returns the name for this password.

Returns:
the password name.
 o setHashingFunction
 public boolean setHashingFunction(HashingAlgorithm algo)
Set the hashing function h such that that passphrase s is stored and tested with h(s).

Parameters:
algo - is the hashing function to be used. This is according to the semper.crypto.CryptoConstants interface. Nothing is done if the paramater does not encode a valid hashing function.
Returns:
true if and only if the hashing function has been changed successfullly.
See Also:
 o getHashingFunction
 public HashingAlgorithm getHashingFunction()
Returns the selected hashing function.

Returns:
the integer encoding the hashing function according to the crypto manager constants.
See Also:
CryptoConstants
 o setMessage
 public void setMessage(String message)
Sets the message explaining why this password is used. The first time the password has to be given, this message will be displayed.

Parameters:
message - is the message to show. If the message is null nothing is done.
Returns:
none.
 o getMessage
 public String getMessage()
Returns the message that will be displayed when the password is given by the user for the first time.

Returns:
the message. If the message has not been set, the default message is returned.
 o showme
 public void showme(PrefFrame p)
Shows the password button in a PrefFrame.

Parameters:
p - is the frame where to put this field.
Returns:
none.
Overrides:
showme in class PrefField
 o getValue
 public Object getValue()
Returns the hashing value of the password. If the password has never been selected then the user is asked to supply one.

Returns:
the shadow of the password. Null is returned if the user did not give a correct passphrase.
Overrides:
getValue in class PrefField
 o getBytesValue
 public byte[] getBytesValue()
The same as Object getValue() but returning an array of bytes directly. If the password has never been selected then the user is asked to supply one.

Returns:
the shadow of the password stored in an array of bytes. Null is returned if the user did not give a correct passphrase.
 o setPassPhraseForChange
 protected byte[] setPassPhraseForChange(Object newval)
Schedules a new passphrase. The hashed value of the new passphrase will be recorded if and only if applyModification is called afterwards.

Parameters:
newval - is the passphrase itself. Must encode a string.
Returns:
none.
See Also:
applyModification
 o setPassPhraseForChange
 protected byte[] setPassPhraseForChange(String password) throws PreferencesException
Same as setPassPhraseForChange(Object newval) but with a string as argument. Used while the user is editing its preferences. Should not be used to set the preferences initially. In that case use setValue(.) instead.

Parameters:
password - is the new passphrase. The passphrase is not saved in this field, just the hashing value is accessible. The length must be greater then 0. If not then nothing is done.
Returns:
the new hashing value corresponding the given password.
See Also:
PrefPasswordButton
 o setValue
 public void setValue(Object passphrase)
Sets the hashing value of the passphrase by specifying the hashing value.

Parameters:
passphrase - is the password. The object must encode a String. If not then a runtime error will be thrown.
Returns:
none.
Overrides:
setValue in class PrefField
 o setValue
 public boolean setValue(String passphrase)
Sets the hashing value of the passphrase by specifying the passphrase itself.

Parameters:
password - is the passphrase itself.
Returns:
true if and only if the change has been preformed. For the time being it is always the case.
 o isEqual
 public boolean isEqual(String password)
Returns true if this password has the same hashing value than the one given as input.

Parameters:
password - is the string that is checked to have the same hashing value than this password. The length must be greater than 0.
Returns:
true if and only if the input passphrase has the same hashing value than this password. Returns false if the input password has length 0.
 o isModified
 public boolean isModified()
Indicates of the user has changed the password. For convenience this method returns true if the password has been modified or the user interrupted the thread allowing to change the password on the TINGUIN.

Returns:
true iff the value has been changed
Overrides:
isModified in class PrefField
 o applyModification
 public boolean applyModification()
Apply the change to the actual password value if it isOK().

Returns:
true if and only if the modification occured.
Overrides:
applyModification in class PrefField
 o cancel
 public void cancel()
This method forget the user's changes. Returns to the state before the user try to change its password. Stops the thread launched on the TINGUIN and try to clean a bit if it is the case.

Returns:
none.
Overrides:
cancel in class PrefField
 o isOK
 public boolean isOK()
Returns true if the new value of the password is correct. That means that the user pass through the thread of changing the password successfully. If the user has not changed the password this method returns true.

Returns:
true iff the user has supplied a valid new password or no changes has been made.
Overrides:
isOK in class PrefField
 o actionPerformed
 public void actionPerformed(ActionEvent event)
This is the method responsible to launch the password change thread when password button is pushed. No thread is launched if there is already one in process.

Parameters:
event - is what occured.

All Packages  Class Hierarchy  This Package  Previous  Next  Index