Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd

public Class PasswordProviderWrapper

extends Object
implements FilePasswordProvider
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.config.keys.FilePasswordProvider
Static Imports
org.apache.sshd.core.CoreModuleProperties.PASSWORD_PROMPTS

A bridge from sshd's FilePasswordProvider to our per-session KeyPasswordProvider API.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Supplier<KeyPasswordProvider>
private PasswordProviderWrapper.PerSessionState
private static final AttributeRepository.AttributeKey<PasswordProviderWrapper.PerSessionState>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getPassword(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
NamedResource
The resource key representing the private file
resource
,
int
The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource)
attemptIndex
)

Implements org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

private PasswordProviderWrapper.PerSessionState
public FilePasswordProvider.ResourceDecodeResult
handleDecodeAttemptResult(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
NamedResource
The resource key representing the private file
resource
,
int
The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource). If success report, it indicates the number of retries it took to succeed
retryIndex
,
String
The password that was attempted
password
,
Exception
The attempt result - null for success
err
)

Overrides default org.apache.sshd.common.config.keys.FilePasswordProvider.handleDecodeAttemptResult.

Invoked to inform the password provide about the decoding result

Note

any exception thrown from this method (including if called to inform about success) will be propagated instead of the original (if any was reported)

private URIish

Returns:

the uri
toUri
(String
to convert
resourceKey
)

Creates a URIish from a given string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

factoryback to summary
private final Supplier<KeyPasswordProvider> factory
noSessionStateback to summary
private PasswordProviderWrapper.PerSessionState noSessionState
STATEback to summary
private static final AttributeRepository.AttributeKey<PasswordProviderWrapper.PerSessionState> STATE

Constructor Detail

PasswordProviderWrapperback to summary
public PasswordProviderWrapper(Supplier<KeyPasswordProvider> factory)

Creates a new PasswordProviderWrapper.

Parameters
factory:Supplier<KeyPasswordProvider>

to use to create per-session KeyPasswordProviders

Method Detail

getPasswordback to summary
public String getPassword(SessionContext session, NamedResource resource, int attemptIndex) throws IOException

Implements org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

Parameters
session:SessionContext

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

resource:NamedResource

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

The resource key representing the private file

attemptIndex:int

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource)

Returns:String

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

The password - if null/empty then no password is required

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.getPassword.

if cannot resolve password

getStateback to summary
private PasswordProviderWrapper.PerSessionState getState(SessionContext context)
handleDecodeAttemptResultback to summary
public FilePasswordProvider.ResourceDecodeResult handleDecodeAttemptResult(SessionContext session, NamedResource resource, int retryIndex, String password, Exception err) throws IOException, GeneralSecurityException

Overrides default org.apache.sshd.common.config.keys.FilePasswordProvider.handleDecodeAttemptResult.

Doc from org.apache.sshd.common.config.keys.FilePasswordProvider.handleDecodeAttemptResult.

Invoked to inform the password provide about the decoding result

Note

any exception thrown from this method (including if called to inform about success) will be propagated instead of the original (if any was reported)

Parameters
session:SessionContext

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

resource:NamedResource

The resource key representing the private file

retryIndex:int

The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource). If success report, it indicates the number of retries it took to succeed

password:String

The password that was attempted

err:Exception

The attempt result - null for success

Returns:FilePasswordProvider.ResourceDecodeResult

How to proceed in case of error - ignored if invoked in order to report success

Note

null is same as ResourceDecodeResult#TERMINATE.

Annotations
@Override
Exceptions
IOException:
If cannot resolve a new password
GeneralSecurityException:
If not attempting to resolve a new password
toUriback to summary
private URIish toUri(String resourceKey)

Creates a URIish from a given string. The CredentialsProvider uses uris as resource identifications.

Parameters
resourceKey:String

to convert

Returns:URIish

the uri

org.eclipse.jgit.internal.transport.sshd back to summary

private Class PasswordProviderWrapper.PerSessionState

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.transport.sshd.PasswordProviderWrapper.PerSessionState

Field Summary

Modifier and TypeField and Description
pack-priv Map<String, AtomicInteger>
pack-priv KeyPasswordProvider

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countsback to summary
pack-priv Map<String, AtomicInteger> counts
delegateback to summary
pack-priv KeyPasswordProvider delegate

Constructor Detail

PerSessionStateback to summary
private PerSessionState()