All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.panels.PasswordPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.sun.wizards.core.WizardComponent
                                   |
                                   +----com.sun.wizards.core.WizardLeaf
                                           |
                                           +----com.sun.wizards.panels.QueryPanel
                                                   |
                                                   +----com.sun.wizards.panels.PasswordPanel

public class PasswordPanel
extends QueryPanel
The PasswordPanel presents the user with the option to enter a password. Only if the user enters the correct password will he be able to continue. The algorithm, provider, and character-to-byte encoding scheme can be specified via the appropriate constructor. The plaintext password provided in the constructor is digested and stored in the serialized panel, but the plaintext is discarded. If desired, a pre-hashed password can be provided.

The password can also be provided in a statefile. The password should be stored under the WizardState key wizard.password.


Constructor Index

 o PasswordPanel()
Creates a PasswordPanel with no name.
 o PasswordPanel(String, Route, WizardTreeManager)
Creates a PasswordPanel with the specified name, the specified route and wizard manager.
 o PasswordPanel(WizardState, String, String)
Creates a PasswordPanel with the specified name for the specified application, using the specified algorithm to compute the hashed password.
 o PasswordPanel(WizardState, String, String, String, String, String)
Creates a PasswordPanel with the specified name for the specified application, using the specified algorithm to compute the hashed password.

Method Index

 o addCriticalStateKeys(Vector)
Adds the WizardState keys that should be set into the WizardState file.
 o addRuntimeResources(Vector)
Get the runtime classes required by this panel.
 o compare(byte[], byte[])
Compares two byte arrays.
 o deserialize(DataInput)
Deserialize this panel from the specified input stream.
 o digestString(String, String, String, String)
Utility method to compute the digest value for a String, using the given algorithm.
 o getAlgorithm()
Gets the algorithm of this password panel
 o getEncoding()
Gets the encoding of this password panel
 o getProvider()
Gets the provider of this password panel
 o isDisplayComplete()
Returns true if this PasswordPanel is finished displaying.
 o serialize(DataOutput)
Serialize this panel to the specified output stream.
 o setAlgorithm(String)
Sets the algorithm of this password panel
 o setEncoding(String)
Sets the encoding of this password panel
 o setPassword(String)
Sets the password of this password panel, encoding it in the supplied algorithm and encoding.
 o setProvider(String)
Sets the provider of this password panel
 o skip()
Causes PasswordPanel to be skipped if a previously-supplied password (via the wizard.password setting) matches.

Constructors

 o PasswordPanel
 public PasswordPanel()
Creates a PasswordPanel with no name.

 o PasswordPanel
 public PasswordPanel(String name,
                      Route route,
                      WizardTreeManager wizardManager)
Creates a PasswordPanel with the specified name, the specified route and wizard manager.

Parameters:
name - The name for this PasswordPanel.
route - The route to the appropriate server side object.
wizardManager - The wizard manager responsible for this component.
 o PasswordPanel
 public PasswordPanel(WizardState wizardState,
                      String name,
                      String password)
Creates a PasswordPanel with the specified name for the specified application, using the specified algorithm to compute the hashed password. The password provided is hashed using the default algorithm, provider, and encoding scheme, and saved into the serialized panel.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this panel.
password - The password to check against at runtime. The cleartext password is not stored.
See Also:
MessageDigest
 o PasswordPanel
 public PasswordPanel(WizardState wizardState,
                      String name,
                      String password,
                      String algorithm,
                      String provider,
                      String encoding)
Creates a PasswordPanel with the specified name for the specified application, using the specified algorithm to compute the hashed password. The password provided is hashed using the algorithm, provider, and encoding scheme, and saved into the serialized panel.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this panel.
password - The password to check against at runtime. The cleartext password is not stored.
provider - The name of the provider to use. null indicates to use the system's default provider.
algorithm - The algorithm to use when comparing the user's password to the stored, hashed password. Default value is "SHA".
encoding - The Char-To-Byte encoding scheme, or null if it is desired to use the platform's default encoding scheme.
See Also:
MessageDigest

Methods

 o setPassword
 public void setPassword(String password)
Sets the password of this password panel, encoding it in the supplied algorithm and encoding. Make sure you set the algorithm, provider and/or encoding to the desired settings before calling this method.

Parameters:
password - The cleartext password of this password panel.
 o getAlgorithm
 public String getAlgorithm()
Gets the algorithm of this password panel

Returns:
The algorithm of this password panel
 o setAlgorithm
 public void setAlgorithm(String algorithm)
Sets the algorithm of this password panel

Parameters:
algorithm - The algorithm of this password panel
 o getProvider
 public String getProvider()
Gets the provider of this password panel

Returns:
The provider of this password panel
 o setProvider
 public void setProvider(String provider)
Sets the provider of this password panel

Parameters:
provider - The provider of this password panel
 o getEncoding
 public String getEncoding()
Gets the encoding of this password panel

Returns:
The encoding of this password panel
 o setEncoding
 public void setEncoding(String encoding)
Sets the encoding of this password panel

Parameters:
encoding - The encoding of this password panel
 o digestString
 public static byte[] digestString(String string,
                                   String algorithm,
                                   String provider,
                                   String encoding)
Utility method to compute the digest value for a String, using the given algorithm. The string is first encoded into bytes, using given encoding scheme, then the hashvalue is computed, using the supplied algorithm.

Parameters:
string - The string to compute the digest value of
provider - The name of the provider to use. null indicates to use the system's default provider.
algorithm - The algorithm to use when comparing the user's password to the stored, hashed password. Default value is "SHA".
encoding - The Char-To-Byte encoding scheme, or null if it is desired to use the platform's default encoding scheme.
See Also:
MessageDigest
 o skip
 public boolean skip()
Causes PasswordPanel to be skipped if a previously-supplied password (via the wizard.password setting) matches.

Returns:
true if the hashed password String stored under the WizardState key wizard.password matches the stored password, false otherwize.
Overrides:
skip in class WizardComponent
 o isDisplayComplete
 public boolean isDisplayComplete()
Returns true if this PasswordPanel is finished displaying. This method is used to set the user's selection into the WizardState before moving to the next panel.

Returns:
true if the display of this panel is complete, false otherwise
Overrides:
isDisplayComplete in class QueryPanel
 o compare
 public static boolean compare(byte b1[],
                               byte b2[])
Compares two byte arrays.

Parameters:
b1 - The first byte array
b2 - The second byte array
Returns:
true, if the byte arrays equal (in length and content), false otherwise.
 o serialize
 protected void serialize(DataOutput out)
Serialize this panel to the specified output stream.

Parameters:
out - The output stream to which this panel will be serialized.
Overrides:
serialize in class QueryPanel
 o deserialize
 protected void deserialize(DataInput in)
Deserialize this panel from the specified input stream.

Parameters:
in - The input stream from which this panel will be deserialized.
Overrides:
deserialize in class QueryPanel
 o addRuntimeResources
 public void addRuntimeResources(Vector resourceVector)
Get the runtime classes required by this panel.

Overrides:
addRuntimeResources in class QueryPanel
 o addCriticalStateKeys
 public void addCriticalStateKeys(Vector keys)
Adds the WizardState keys that should be set into the WizardState file.

Parameters:
keys - The vector of keys that will be added to the WizardState file.
Overrides:
addCriticalStateKeys in class WizardComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index