g-Eclipse
Release 1.0.0

eu.geclipse.core.auth
Class PasswordManager

java.lang.Object
  extended by eu.geclipse.core.auth.PasswordManager

public abstract class PasswordManager
extends java.lang.Object

The PasswordManager provides some static methods to manage passwords. Therefore each password is stored with a unique password ID and can afterwards be retrieved again with this ID. In the case of a private key this id could be the path to the key file in the file system. If the key file is then opened for the first time the user is asked for the password. Then the password is stored with the file path as pwuid. If the file has to be opened a second time the user does not have to specify the password again since the PasswordManager has already stored it and knows that it belongs to the key file. The PasswordManager currently relies on Equinox's secure storage (SS) mechanism to persist passwords across sessions. Note however that this SS does have an access password of its own. Therefore, depending on the SS settings and also the platform, the user might need to provide the SS password to access its stored passwords. If the user avoids providing this SS password then an internal in-memory implementation is used to keep already entered passwords for the lifetime of the gEclipse session.


Constructor Summary
PasswordManager()
           
 
Method Summary
static void erasePassword(java.lang.String pwuid)
          Erase the password with the specified ID.
static java.lang.String getPassword(java.lang.String pwuid)
          Look up the password with the specified ID and return it if it could be found.
static void registerPassword(java.lang.String pwuid, java.lang.String pw)
          Register a password with the specified ID in this password manager.
static void setUseSecureStorage(boolean useSS)
          Selects the type of storage to use, either Equinox's secure storage or the internal implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordManager

public PasswordManager()
Method Detail

setUseSecureStorage

public static void setUseSecureStorage(boolean useSS)
Selects the type of storage to use, either Equinox's secure storage or the internal implementation. Needed in certain cases if running in head-less mode. Do not switch the mode if the user is interacting with the system!

Parameters:
useSS - if Equinox's secure storage should be used or not

getPassword

public static java.lang.String getPassword(java.lang.String pwuid)
Look up the password with the specified ID and return it if it could be found.

Parameters:
pwuid - The unique ID of the password.
Returns:
The password if it could be found, null otherwise.

registerPassword

public static void registerPassword(java.lang.String pwuid,
                                    java.lang.String pw)
Register a password with the specified ID in this password manager. If a password with the same ID was registered before it is erases before this password is registered.

Parameters:
pwuid - The unique ID of the new password.
pw - The password that should be registered.

erasePassword

public static void erasePassword(java.lang.String pwuid)
Erase the password with the specified ID. Nothing happens if the password could not be found.

Parameters:
pwuid - The unique ID of the password that should be erased.

g-Eclipse
Release 1.0.0