org.eclipse.rse.ui.subsystems
Class StandardCredentialsProvider
java.lang.Object
org.eclipse.rse.core.subsystems.AbstractCredentialsProvider
org.eclipse.rse.ui.subsystems.StandardCredentialsProvider
-
All Implemented Interfaces:
-
ICredentialsProvider
-
public class StandardCredentialsProvider
- extends
AbstractCredentialsProvider
The
StandardCredentialsProvider
is an extension of
AbstractCredentialsProvider
that provides for the prompting of a userid
and password.
It uses a
PasswordPersistenceManager
to store the passwords in the
keychain keyed by
IHost
and possibly by
ISubSystemConfiguration
.
This is suitable for use by subclasses of
StandardConnectorService
that wish to provide prompting and persistence for userids and passwords when
connecting.
This class is may be subclassed. Typically to provide connector service
specific prompting.
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
StandardCredentialsProvider
public StandardCredentialsProvider(
IConnectorService connectorService)
- Creates a standard credentials provider for a connector service.
-
Parameters:
-
connectorService
- the connector service associated with this
provider. -
See Also:
-
IConnectorService
acquireCredentials
public final void acquireCredentials(boolean reacquire)
throws
OperationCanceledException
- Acquires the credentials (userid and password) for this connector
service. The search order for the password is as follows:
- First check if the password is already known by this connector
service and that it is still valid.
- If password not known then look in the password store and verify that
it is still valid.
- If a valid password is not found or is to be re-acquired then prompt
the user
-
-
Parameters:
-
reacquire
- if true then present the prompt even if the password was
found and is valid.
-
Throws:
-
OperationCanceledException
- if user is prompted and user cancels
that prompt or if
AbstractCredentialsProvider.isSuppressed()
is true. Before RSE 3.0,
the method would have thrown
InterruptedException
in that
case. -
Since:
- 3.0
clearCredentials
public final void clearCredentials()
-
Description copied from interface:
ICredentialsProvider
- Clears the credentials known by this credentials provider. This will
cause a reacquistion of all compoenents of the credentials at the next
acquire. If credentials consist of a user id and password then both of those
are cleared.
Does not clear any persistently remembered values.
-
clearPassword
public final void clearPassword()
-
Description copied from interface:
ICredentialsProvider
- If the credentials include a password or equivalent then clears only that
that portion of the credentials. If the credentials do not include a password
then the implementation may somehow invalidate the credentials so that
they will be reacquired at the next acquisition.
-
getCredentials
public final
ICredentials getCredentials()
-
Description copied from interface:
ICredentialsProvider
- Retrieves the credentials known to this credentials provider. Does not
cause the credentials to be acquired. May be used after
ICredentialsProvider.acquireCredentials(boolean)
to retrieve credentials.
-
-
Returns:
- the credentials that have previously been acquired or repaired.
May be null if no credentials have yet been acquired.
getUserId
public final
String getUserId()
-
Description copied from interface:
ICredentialsProvider
- If the credentials include a user id then retrieve that user id.
If the credentials do not currently contain a user id then a default user id
related to the connector service may be obtained.
If the credentials do not support a user id then this should return null.
-
-
Returns:
- the userid of the credentials held by this provider
repairCredentials
public final void repairCredentials(
SystemMessage prompt)
throws
OperationCanceledException
-
Description copied from interface:
ICredentialsProvider
- The connector service using this provider may find the credentials provided
are incorrector or expired. This method asks the provider to repair those
credentials. This would typically be used to present a dialog asking for the reentry of
an expired password.
-
-
Parameters:
-
prompt
- the message indicating the nature of the damage that must
be repaired. For example, indicating expiration of a password.
-
Throws:
-
OperationCanceledException
- if the repair is cancelled for some reason. This could
include the inability of a credentials provider to open a dialog or a dialog being
cancelled.
setPassword
public final void setPassword(
String password)
-
Description copied from interface:
ICredentialsProvider
- If the credentials include a password or equivalent then set that password
to the new value.
If the credentials do not include a password then
the implementation may ignore this.
-
-
Parameters:
-
password
- the new value of the password in the credentials held by this provider
setPassword
public final void setPassword(
String matchingUserId,
String password,
boolean persist)
-
Useful utility method. Fully implemented, no need to override.
Set the password if you got it from somewhere
-
-
Parameters:
-
matchingUserId
- the user for which to set the password -
password
- the password to set for this userid -
persist
- true if the password is to be persisted as well
setUserId
public final void setUserId(
String newId)
-
Description copied from interface:
ICredentialsProvider
- If the credentials include a user id then set that user id to the new value.
If the credentials do not include a user id then this is implementation
defined.
-
-
Parameters:
-
newId
- the user id to place into the credentials held by this provider
getPasswordPromptDialog
protected
ISystemPasswordPromptDialog getPasswordPromptDialog(
Shell shell)
-
A default implementation is supplied, but can be overridden if desired.
Instantiates and returns the dialog to prompt for the userId and password.
-
-
Returns:
- An instance of a dialog class that implements
ISystemPasswordPromptDialog
getSignonValidator
protected
ICredentialsValidator getSignonValidator()
-
Optionally overridable, not implemented by default.
Get the credentials validator to use to validate the credentials as entered
in the dialog. This should only do a local validation.
-
-
Returns:
- null indicating that no signon validator exists.
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.