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'sRepeatingFilePasswordProviderto ourKeyPasswordProviderAPI.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicInteger>countsprivate KeyPasswordProviderdelegate
-
Constructor Summary
Constructors Constructor Description PasswordProviderWrapper(KeyPasswordProvider delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAttempts()Gets the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.java.lang.StringgetPassword(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int attemptIndex)org.apache.sshd.common.config.keys.FilePasswordProvider.ResourceDecodeResulthandleDecodeAttemptResult(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, int retryIndex, java.lang.String password, java.lang.Exception err)voidsetAttempts(int numberOfPasswordPrompts)Define the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.private URIishtoUri(java.lang.String resourceKey)Creates aURIishfrom 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:RepeatingFilePasswordProviderDefine the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.- Specified by:
setAttemptsin interfaceRepeatingFilePasswordProvider- Parameters:
numberOfPasswordPrompts- number of times to ask for a password;IllegalArgumentExceptionmay be thrown if <= 0
-
getAttempts
public int getAttempts()
Description copied from interface:RepeatingFilePasswordProviderGets the maximum number of attempts to get a password that should be attempted for one identity resource through this provider.- Specified by:
getAttemptsin 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:
getPasswordin 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:
handleDecodeAttemptResultin interfaceorg.apache.sshd.common.config.keys.FilePasswordProvider- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
toUri
private URIish toUri(java.lang.String resourceKey)
Creates aURIishfrom a given string. TheCredentialsProvideruses uris as resource identifications.- Parameters:
resourceKey- to convert- Returns:
- the uri
-
-