Top Description Fields Constructors Methods
org.apache.sshd.common.config.keys.loader

public Class FileWatcherKeyPairResourceLoader

extends ModifiableFileWatcher
implements KeyPairResourceLoader
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
Imports
java.io.IOException, java.nio.file.LinkOption, .Path, java.security.GeneralSecurityException, .KeyPair, java.util.Collection, .Collections, .List, .Objects, java.util.concurrent.atomic.AtomicReference, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.FilePasswordProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.io.IoUtils, .ModifiableFileWatcher, org.apache.sshd.common.util.io.resource.PathResource

Tracks a file containing KeyPair-s an re-loads it whenever a change has been sensed in the monitored file (if it exists)
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private KeyPairResourceLoader
protected final AtomicReference<Collection<KeyPair>>
Inherited from org.apache.sshd.common.util.io.ModifiableFileWatcher:
optionsSTRICTLY_PROHIBITED_FILE_PERMISSION

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public KeyPairResourceLoader
public Collection<KeyPair>
loadKeyPairs(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
A hint as to the origin of the text lines
resourceKey
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected
passwordProvider
,
List<String>
The List of lines as read from the resource
lines
)

Implements org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader.loadKeyPairs.

Loads key pairs from the given resource text lines

protected Collection<KeyPair>
reloadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines)

public void
Inherited from org.apache.sshd.common.util.io.ModifiableFileWatcher:
checkReloadRequiredexistsgetPathlastModifiedresetReloadAttributessizetoPathResourcetoPathResourcetoStringupdateReloadAttributesvalidateStrictConfigFilePermissions

Field Detail

delegateLoaderback to summary
private KeyPairResourceLoader delegateLoader
keysHolderback to summary
protected final AtomicReference<Collection<KeyPair>> keysHolder

Constructor Detail

FileWatcherKeyPairResourceLoaderback to summary
public FileWatcherKeyPairResourceLoader(Path file, KeyPairResourceLoader delegateLoader)
FileWatcherKeyPairResourceLoaderback to summary
public FileWatcherKeyPairResourceLoader(Path file, KeyPairResourceLoader delegateLoader, LinkOption... options)

Method Detail

getKeyPairResourceLoaderback to summary
public KeyPairResourceLoader getKeyPairResourceLoader()
loadKeyPairsback to summary
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader.loadKeyPairs.

Doc from org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader.loadKeyPairs.

Loads key pairs from the given resource text lines

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

resourceKey:NamedResource

A hint as to the origin of the text lines

passwordProvider:FilePasswordProvider

The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected

lines:List<String>

The List of lines as read from the resource

Returns:Collection<KeyPair>

The extracted KeyPairs - may be null/empty if none

Note

the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it

Annotations
@Override
Exceptions
IOException:
If failed to process the lines
GeneralSecurityException:
If failed to generate the keys from the parsed data
reloadKeyPairsback to summary
protected Collection<KeyPair> reloadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) throws IOException, GeneralSecurityException
setKeyPairResourceLoaderback to summary
public void setKeyPairResourceLoader(KeyPairResourceLoader loader)