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
-
_algo
-
-
BUTTON_PREFIX
-
-
internalLayout
-
-
maximum_length
-
-
minimum_length
-
-
panel
-
-
StandardDefaultPassWord
-
-
PrefFieldPassWord()
-
Constructor used by new Instance when internalizing this object.
-
PrefFieldPassWord(String, String)
-
Constructor for password field with default constraints and password.
-
PrefFieldPassWord(String, String, String)
-
Constructor for password field with default constraints.
-
PrefFieldPassWord(String, String, String, GridBagConstraints)
-
Constructor for password field with guenuine constraints.
-
actionPerformed(ActionEvent)
-
This is the method responsible to launch the password change thread when
password button is pushed.
-
applyModification()
-
Apply the change to the actual password value if it isOK().
-
cancel()
-
This method forget the user's changes.
-
getBytesValue()
-
The same as Object getValue() but returning
an array of bytes directly.
-
getHashingFunction()
-
Returns the selected hashing function.
-
getMessage()
-
Returns the message that will be displayed when the password
is given by the user for the first time.
-
getPasswordName()
-
Returns the name for this password.
-
getValue()
-
Returns the hashing value of the password.
-
isEqual(String)
-
Returns true if this password has the same hashing value
than the one given as input.
-
isModified()
-
Indicates of the user has changed the password.
-
isOK()
-
Returns true if the new value of the password is correct.
-
setHashingFunction(HashingAlgorithm)
-
Set the hashing function h such that that passphrase
s is stored and tested with h(s).
-
setMessage(String)
-
Sets the message explaining why this password is used.
-
setPassPhraseForChange(Object)
-
Schedules a new passphrase.
-
setPassPhraseForChange(String)
-
Same as setPassPhraseForChange(Object newval) but with a string
as argument.
-
setValue(Object)
-
Sets the hashing value of the passphrase by specifying the
hashing value.
-
setValue(String)
-
Sets the hashing value of the passphrase by specifying the passphrase
itself.
-
showme(PrefFrame)
-
Shows the password button in a PrefFrame.
BUTTON_PREFIX
public static final String BUTTON_PREFIX
_algo
public HashingAlgorithm _algo
panel
public PrefPanel panel
internalLayout
public FlowLayout internalLayout
StandardDefaultPassWord
public static final String StandardDefaultPassWord
minimum_length
public int minimum_length
maximum_length
public int maximum_length
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.
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.
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
PrefFieldPassWord
public PrefFieldPassWord()
- Constructor used by new Instance when internalizing this object.
Othwerwise, should not be used.
- Returns:
- the new empty field.
getPasswordName
public String getPasswordName()
- Returns the name for this password.
- Returns:
- the password name.
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:
-
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
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.
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.
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
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
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.
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
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
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
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.
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.
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
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
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
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
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