Class PasswordProviderWrapper
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.sshd.PasswordProviderWrapper
-
- All Implemented Interfaces:
org.apache.sshd.common.config.keys.FilePasswordProvider
,RepeatingFilePasswordProvider
public class PasswordProviderWrapper extends java.lang.Object implements RepeatingFilePasswordProvider
A bridge from sshd'sRepeatingFilePasswordProvider
to ourKeyPasswordProvider
API.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicInteger>
counts
private KeyPasswordProvider
delegate
-
Constructor Summary
Constructors Constructor Description PasswordProviderWrapper(KeyPasswordProvider delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAttempts()
Gets the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.java.lang.String
getPassword(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int attemptIndex)
org.apache.sshd.common.config.keys.FilePasswordProvider.ResourceDecodeResult
handleDecodeAttemptResult(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int retryIndex, java.lang.String password, java.lang.Exception err)
void
setAttempts(int numberOfPasswordPrompts)
Define the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.private URIish
toUri(java.lang.String resourceKey)
Creates aURIish
from a given string.
-
-
-
Field Detail
-
delegate
private final KeyPasswordProvider delegate
-
counts
private java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicInteger> counts
-
-
Constructor Detail
-
PasswordProviderWrapper
public PasswordProviderWrapper(@NonNull KeyPasswordProvider delegate)
- Parameters:
delegate
-
-
-
Method Detail
-
setAttempts
public void setAttempts(int numberOfPasswordPrompts)
Description copied from interface:RepeatingFilePasswordProvider
Define the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.- Specified by:
setAttempts
in interfaceRepeatingFilePasswordProvider
- Parameters:
numberOfPasswordPrompts
- number of times to ask for a password;IllegalArgumentException
may be thrown if <= 0
-
getAttempts
public int getAttempts()
Description copied from interface:RepeatingFilePasswordProvider
Gets the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.- Specified by:
getAttempts
in interfaceRepeatingFilePasswordProvider
- Returns:
- the maximum number of attempts to try, always >= 1.
-
getPassword
public java.lang.String getPassword(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int attemptIndex) throws java.io.IOException
- Specified by:
getPassword
in interfaceorg.apache.sshd.common.config.keys.FilePasswordProvider
- Throws:
java.io.IOException
-
handleDecodeAttemptResult
public org.apache.sshd.common.config.keys.FilePasswordProvider.ResourceDecodeResult handleDecodeAttemptResult(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int retryIndex, java.lang.String password, java.lang.Exception err) throws java.io.IOException, java.security.GeneralSecurityException
- Specified by:
handleDecodeAttemptResult
in interfaceorg.apache.sshd.common.config.keys.FilePasswordProvider
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
toUri
private URIish toUri(java.lang.String resourceKey)
Creates aURIish
from a given string. TheCredentialsProvider
uses uris as resource identifications.- Parameters:
resourceKey
- to convert- Returns:
- the uri
-
-