RSE
Release 3.4

org.eclipse.rse.core
Class PasswordPersistenceManager

java.lang.Object
  extended by org.eclipse.rse.core.PasswordPersistenceManager

public class PasswordPersistenceManager
extends Object

PasswordPersistenceManager manages the saving and retrieving of user IDs / passwords to Equinox secure storage for registered system types.


Field Summary
static IRSESystemType DEFAULT_SYSTEM_TYPE
           
static String DEFAULT_USER_NAME
           
static int RC_ALREADY_EXISTS
           
static int RC_DENIED
           
static int RC_ERROR
           
static int RC_OK
           
 
Method Summary
 int add(SystemSignonInformation info, boolean overwrite)
          Add a password to the password database.
 int add(SystemSignonInformation info, boolean overwrite, boolean updateDefault)
          Add a password to the password database.
 SystemSignonInformation find(IRSESystemType systemType, String hostName, String userId)
          Find the password for the specified system type, host name and user id.
 SystemSignonInformation find(IRSESystemType systemType, String hostName, String userId, boolean checkDefault)
          Find the password for the specified system type, host name and user id.
static PasswordPersistenceManager getInstance()
          Retrieve the singleton instance of the PasswordPersistenceManger
 IRSESystemType[] getRegisteredSystemTypes()
          Retrieve the list of registered system types.
 List getSavedUserIDs()
          Retrieves a list of SystemSignonInformation instances that have been saved.
 boolean isUserIDCaseSensitive(IRSESystemType systemType)
          Helper method for determining if system type uses case sensitive user IDs.
 boolean passwordExists(IRSESystemType systemType, String hostName, String userId)
          Determines if password entry exists for a given system type, host name, and user id.
 boolean passwordExists(IRSESystemType systemType, String hostName, String userId, boolean checkDefault)
          Determine if a password entry exists for the specified system type, host name, and user id.
 int remove(IRSESystemType systemType, String hostName)
          Removes all passwords for a host name for a given system type.
 void remove(IRSESystemType systemType, String hostName, String userId)
          Removes all entries that match the host name, user id, and system type.
 void remove(SystemSignonInformation info)
          Remove the password entry that matches the system type, host name and user ID from the SystemSignonInfo parameter.
 void reset(IRSESystemType systemType)
          Resets a given system type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RC_OK

public static final int RC_OK
See Also:
Constant Field Values

RC_ALREADY_EXISTS

public static final int RC_ALREADY_EXISTS
See Also:
Constant Field Values

RC_DENIED

public static final int RC_DENIED
Since:
org.eclipse.rse.core 3.0
See Also:
Constant Field Values

RC_ERROR

public static final int RC_ERROR
See Also:
Constant Field Values

DEFAULT_SYSTEM_TYPE

public static final IRSESystemType DEFAULT_SYSTEM_TYPE

DEFAULT_USER_NAME

public static final String DEFAULT_USER_NAME
See Also:
Constant Field Values
Method Detail

getInstance

public static final PasswordPersistenceManager getInstance()
Retrieve the singleton instance of the PasswordPersistenceManger


reset

public void reset(IRSESystemType systemType)
Resets a given system type. This clears the storage for this system type and allows it to be re-migrated. This is not API.

Parameters:
systemType - the system type to reset
Since:
org.eclipse.rse.core 3.4

add

public int add(SystemSignonInformation info,
               boolean overwrite)
Add a password to the password database. This will not update the entry for the default system type

Parameters:
info - The signon information to store
overwrite - Whether to overwrite any existing entry
Returns:
RC_OK if the password was successfully stored RC_ALREADY_EXISTS if the password already exists and overwrite was false

add

public int add(SystemSignonInformation info,
               boolean overwrite,
               boolean updateDefault)
Add a password to the password database.

Parameters:
info - The SystemSignonInformation to store
overwrite - If true then overwrite the existing entry for this system type, host name, and user id.
updateDefault - if true then set the entry for the default system type, host name, and user ID, according to the overwrite setting.
Returns:
RC_OK if the password was successfully stored. RC_ALREADY_EXISTS if the password already exists and overwrite was false RC_DENIED if passwords may not be saved for this system type and host

passwordExists

public boolean passwordExists(IRSESystemType systemType,
                              String hostName,
                              String userId)
Determines if password entry exists for a given system type, host name, and user id.

Parameters:
systemType - the IRSESystemType instance to find a password for.
hostName - the name of the host we are examining for a password.
userId - the user id to find passwords for.
Returns:
true if a password exists that meets the search criteria.

passwordExists

public boolean passwordExists(IRSESystemType systemType,
                              String hostName,
                              String userId,
                              boolean checkDefault)
Determine if a password entry exists for the specified system type, host name, and user id.

Parameters:
systemType - the IRSESystemType instance to find a password for.
hostName - the name of the host we are examining for a password.
userId - the user id to find passwords for.
checkDefault - Whether or not to check for a default system type if the specified system type is not found.
Returns:
true if a password exists that meets the search criteria.

find

public SystemSignonInformation find(IRSESystemType systemType,
                                    String hostName,
                                    String userId)
Find the password for the specified system type, host name and user id. If one is not found then the default system type is also searched, thus the system type in the returned SystemSignonInformation may not be the same as the system type specified in the argument.

Parameters:
systemType - the IRSESystemType instance to find a password for.
hostName - the name of the host we are examining for a password.
userId - the user id to find passwords for.
Returns:
the SystemSignonInformation for the specified criteria.

find

public SystemSignonInformation find(IRSESystemType systemType,
                                    String hostName,
                                    String userId,
                                    boolean checkDefault)
Find the password for the specified system type, host name and user id. If one is not found then the default system type is also searched, thus the system type in the returned SystemSignonInformation may not be the same as the system type specified in the argument.

Parameters:
systemType - the IRSESystemType instance to find a password for.
hostName - the name of the host we are examining for a password.
userId - the user id to find passwords for.
checkDefault - true if the default system type should be checked if the specified system type is not found
Returns:
the SystemSignonInformation for the specified criteria.

remove

public void remove(SystemSignonInformation info)
Remove the password entry that matches the system type, host name and user ID from the SystemSignonInfo parameter.


remove

public int remove(IRSESystemType systemType,
                  String hostName)
Removes all passwords for a host name for a given system type. This does not remove entries for the default system type. The default system type must be explicitly stated to remove those entries.

Parameters:
systemType - The system type of the host
hostName - The IP address or name of the host in canonical format
Returns:
the number of passwords removed
Since:
org.eclipse.rse.core 3.0

remove

public void remove(IRSESystemType systemType,
                   String hostName,
                   String userId)
Removes all entries that match the host name, user id, and system type. This does not remove entries for the default system type. The default system type must be explicitly stated to remove those entries.

Parameters:
systemType - the systemType
hostName - the connection name
userId - the user id

getRegisteredSystemTypes

public IRSESystemType[] getRegisteredSystemTypes()
Retrieve the list of registered system types. This includes the default system type as well.

Returns:
an array of IRSESystemType.

getSavedUserIDs

public List getSavedUserIDs()
Retrieves a list of SystemSignonInformation instances that have been saved. These instances do not contain the saved passwords.

Returns:
List A list of the stored user IDs as SystemSignonInformation instances without the saved passwords.

isUserIDCaseSensitive

public boolean isUserIDCaseSensitive(IRSESystemType systemType)
Helper method for determining if system type uses case sensitive user IDs.

Returns:
true if the system type treats user ids as case sensitive.

RSE
Release 3.4

Copyright (c) IBM Corporation and others 2000, 2012. All Rights Reserved.