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

public Class CachingKeyPairProvider

extends FileKeyPairProvider
implements Iterable<KeyPair>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Static Imports
java.text.MessageFormat.format

A FileKeyPairProvider that uses an external KeyCache.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final KeyCache
public static final AttributeRepository.AttributeKey<Map<String, Path>>
KEY_PATHS_BY_FINGERPRINT

An attribute set on the SessionContext recording loaded keys by fingerprint.

Constructor Summary

AccessConstructor and Description
public
CachingKeyPairProvider(List<Path>
to load keys from
paths
,
KeyCache
to use, may be null if no external caching is desired
cache
)

Creates a new CachingKeyPairProvider using the given KeyCache.

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
getKeyId(ClientSession session, KeyPair identity)

public Iterator<KeyPair>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

private Iterator<KeyPair>
private KeyPair
loadKey(SessionContext session, Path path)

private KeyPair
loadKey(SessionContext session, NamedResource resource, Path path, FilePasswordProvider passwordProvider)

public Iterable<KeyPair>
loadKeys(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
)

Overrides org.apache.sshd.common.keyprovider.FileKeyPairProvider.loadKeys.

Implements org.apache.sshd.common.keyprovider.KeyIdentityProvider.loadKeys.

Load available keys.

Inherited from org.apache.sshd.common.keyprovider.FileKeyPairProvider:
doLoadKeysgetIoResourcegetPathssetPaths

Field Detail

cacheback to summary
private final KeyCache cache
KEY_PATHS_BY_FINGERPRINTback to summary
public static final AttributeRepository.AttributeKey<Map<String, Path>> KEY_PATHS_BY_FINGERPRINT

An attribute set on the SessionContext recording loaded keys by fingerprint. This enables us to provide nicer output by showing key paths, if possible. Users can identify key identities used easier by filename than by fingerprint.

Constructor Detail

CachingKeyPairProviderback to summary
public CachingKeyPairProvider(List<Path> paths, KeyCache cache)

Creates a new CachingKeyPairProvider using the given KeyCache. If the cache is null, this is a simple FileKeyPairProvider.

Parameters
paths:List<Path>

to load keys from

cache:KeyCache

to use, may be null if no external caching is desired

Method Detail

getKeyIdback to summary
pack-priv static String getKeyId(ClientSession session, KeyPair identity)
iteratorback to summary
public Iterator<KeyPair> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<KeyPair>

an Iterator.

Annotations
@Override
iteratorback to summary
private Iterator<KeyPair> iterator(SessionContext session)
loadKeyback to summary
private KeyPair loadKey(SessionContext session, Path path) throws IOException, GeneralSecurityException
loadKeyback to summary
private KeyPair loadKey(SessionContext session, NamedResource resource, Path path, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException
loadKeysback to summary
public Iterable<KeyPair> loadKeys(SessionContext session)

Overrides org.apache.sshd.common.keyprovider.FileKeyPairProvider.loadKeys.

Implements org.apache.sshd.common.keyprovider.KeyIdentityProvider.loadKeys.

Doc from org.apache.sshd.common.keyprovider.KeyIdentityProvider.loadKeys.

Load available keys.

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).

Returns:Iterable<KeyPair>

an Iterable instance of available keys - ignored if null

Annotations
@Override
org.eclipse.jgit.internal.transport.sshd back to summary

private Class CachingKeyPairProvider.CancellingKeyPairIterator

extends Object
implements Iterator<KeyPair>
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.transport.sshd.CachingKeyPairProvider.CancellingKeyPairIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final SessionContext
private KeyPair
private boolean
private final Iterator<Path>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public KeyPair
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final SessionContext context
nextItemback to summary
private KeyPair nextItem
nextSetback to summary
private boolean nextSet
pathsback to summary
private final Iterator<Path> paths

Constructor Detail

CancellingKeyPairIteratorback to summary
public CancellingKeyPairIterator(SessionContext session, Collection<? extends Path> resources)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public KeyPair next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:KeyPair

the next element in the iteration

Annotations
@Override