KeyPasswordProvider based on a CredentialsProvider.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | IdentityPasswordProvider.
A simple state object for repeated attempts to get a password for a resource. |
| Modifier and Type | Field and Description |
|---|---|
| private int | attempts
The number of times to ask successively for a password for a given identity resource. |
| private final Map | current
Counts per resource key. |
| private CredentialsProvider |
| Access | Constructor and Description |
|---|---|
| public | IdentityPasswordProvider(CredentialsProvider
to use provider)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public int | getAttempts()
Overrides default org. Gets the maximum number of attempts to get a passphrase that should be attempted for one identity resource through this provider. |
| protected CredentialsProvider | |
| public char[] | getPassphrase(URIish
identifying the key resource that is being attempted to be
loaded uri, int the number of previous attempts to get a passphrase; >= 0 attempt)Implements org. Obtains a passphrase to use to decrypt an ecrypted private key. |
| protected char[] | Returns: the password, ornull or the empty string if none
available.identifying the resource to obtain a password for uri, int number of previous attempts to get a passphrase attempt, IdentityPasswordProvider.encapsulating state information about attempts to get the
password stateRetrieves a password to decrypt a private key. |
| protected char[] | getPassword(URIish
identifying the resource to obtain a password for uri, String optional message text to display; may be message)null or empty
if noneObtains the passphrase/password for an encrypted private key via the
|
| protected boolean | Returns: how to proceed in case of erroridentifying the key resource the key was attempted to be
loaded from uri, IdentityPasswordProvider.associated with this key state,the password that was attempted password, Exception the attempt result - err)null for successInvoked to inform the password provider about the decoding result. |
| public boolean | keyLoaded(URIish
identifying the key resource the key was attempted to be
loaded from uri, int the number of times attempt, Exception getPassphrase(URIish, int) had
been called; zero indicates that uri refers to a
non-encrypted keynull if the key was loaded successfully; otherwise an
exception indicating why the key could not be loadedImplements org. Invoked after a key has been loaded. |
| public void | setAttempts(int
number of times to ask for a passphrase;
numberOfPasswordPrompts)IllegalArgumentException may be thrown if <= 0Implements org. Define the maximum number of attempts to get a passphrase that should be attempted for one identity resource through this provider. |
| attempts | back to summary |
|---|---|
| private int attempts The number of times to ask successively for a password for a given identity resource. | |
| current | back to summary |
|---|---|
| private final Map<URIish, IdentityPasswordProvider. Counts per resource key. | |
| provider | back to summary |
|---|---|
| private CredentialsProvider provider | |
| IdentityPasswordProvider | back to summary |
|---|---|
| public IdentityPasswordProvider(CredentialsProvider provider) Creates a new
| |
| cancelAuthentication | back to summary |
|---|---|
| protected void cancelAuthentication() Cancels the authentication process. Called by
This default implementation always throws a
| |
| getAttempts | back to summary |
|---|---|
| public int getAttempts() Overrides default org. Doc from org. Gets the maximum number of attempts to get a passphrase that should be attempted for one identity resource through this provider. The default return 1.
| |
| getCredentialsProvider | back to summary |
|---|---|
| protected CredentialsProvider getCredentialsProvider() Retrieves the JGit
| |
| getPassphrase | back to summary |
|---|---|
| public char[] getPassphrase(URIish uri, int attempt) throws IOException Implements org. Doc from org. Obtains a passphrase to use to decrypt an ecrypted private key. Returning
| |
| getPassword | back to summary |
|---|---|
| protected char[] getPassword(URIish uri, int attempt, IdentityPasswordProvider. Retrieves a password to decrypt a private key.
| |
| getPassword | back to summary |
|---|---|
| protected char[] getPassword(URIish uri, String message) Obtains the passphrase/password for an encrypted private key via the
| |
| keyLoaded | back to summary |
|---|---|
| protected boolean keyLoaded(URIish uri, IdentityPasswordProvider. Invoked to inform the password provider about the decoding result.
| |
| keyLoaded | back to summary |
|---|---|
| public boolean keyLoaded(URIish uri, int attempt, Exception error) throws IOException, GeneralSecurityException Implements org. Doc from org. Invoked after a key has been loaded. If this raises an exception, the
original
| |
| setAttempts | back to summary |
|---|---|
| public void setAttempts(int numberOfPasswordPrompts) Implements org. Doc from org. Define the maximum number of attempts to get a passphrase that should be attempted for one identity resource through this provider.
| |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public char[] | Returns: the password, ornull if none was obtainedRetrieves the password from the current attempt. |
| public int | |
| public void |
| State | back to summary |
|---|---|
| protected State() | |
| getCount | back to summary |
|---|---|
| public int getCount() Obtains the current count. The initial count is zero.
| |
| getPassword | back to summary |
|---|---|
| public char[] getPassword() Retrieves the password from the current attempt.
| |
| incCount | back to summary |
|---|---|
| public int incCount() Increments the current count. Should be called for each new attempt to get a password.
| |
| setPassword | back to summary |
|---|---|
| public void setPassword(char[] password) Remembers the password.
| |