Class ClientIdentityFileWatcher
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.io.ModifiableFileWatcher
-
- org.apache.sshd.client.config.keys.ClientIdentityFileWatcher
-
- All Implemented Interfaces:
ClientIdentityLoaderHolder
,ClientIdentityProvider
,FilePasswordProviderHolder
public class ClientIdentityFileWatcher extends ModifiableFileWatcher implements ClientIdentityProvider, ClientIdentityLoaderHolder, FilePasswordProviderHolder
AClientIdentityProvider
that watches a given key file re-loading its contents if it is ever modified, deleted or (re-)created- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.util.io.ModifiableFileWatcher
options, STRICTLY_PROHIBITED_FILE_PERMISSION
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description ClientIdentityFileWatcher(Path path, ClientIdentityLoaderHolder loader, FilePasswordProviderHolder provider)
ClientIdentityFileWatcher(Path path, ClientIdentityLoaderHolder loader, FilePasswordProviderHolder provider, boolean strict)
ClientIdentityFileWatcher(Path path, ClientIdentityLoader loader, FilePasswordProvider provider)
ClientIdentityFileWatcher(Path path, ClientIdentityLoader loader, FilePasswordProvider provider, boolean strict)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<KeyPair>
getClientIdentities(SessionContext session)
Provides aKeyPair
representing the client identityClientIdentityLoader
getClientIdentityLoader()
FilePasswordProvider
getFilePasswordProvider()
boolean
isStrict()
protected Iterable<KeyPair>
reloadClientIdentities(SessionContext session, Path path)
-
Methods inherited from class org.apache.sshd.common.util.io.ModifiableFileWatcher
checkReloadRequired, exists, getPath, lastModified, resetReloadAttributes, size, toPathResource, toPathResource, toString, updateReloadAttributes, validateStrictConfigFilePermissions
-
-
-
-
Constructor Detail
-
ClientIdentityFileWatcher
public ClientIdentityFileWatcher(Path path, ClientIdentityLoader loader, FilePasswordProvider provider)
-
ClientIdentityFileWatcher
public ClientIdentityFileWatcher(Path path, ClientIdentityLoader loader, FilePasswordProvider provider, boolean strict)
-
ClientIdentityFileWatcher
public ClientIdentityFileWatcher(Path path, ClientIdentityLoaderHolder loader, FilePasswordProviderHolder provider)
-
ClientIdentityFileWatcher
public ClientIdentityFileWatcher(Path path, ClientIdentityLoaderHolder loader, FilePasswordProviderHolder provider, boolean strict)
-
-
Method Detail
-
isStrict
public boolean isStrict()
-
getClientIdentityLoader
public ClientIdentityLoader getClientIdentityLoader()
- Specified by:
getClientIdentityLoader
in interfaceClientIdentityLoaderHolder
- Returns:
- The
ClientIdentityLoader
to use in order to load client key pair identities - nevernull
-
getFilePasswordProvider
public FilePasswordProvider getFilePasswordProvider()
- Specified by:
getFilePasswordProvider
in interfaceFilePasswordProviderHolder
- Returns:
- The
FilePasswordProvider
to use if need to load encrypted identities keys - nevernull
- See Also:
FilePasswordProvider.EMPTY
-
getClientIdentities
public Iterable<KeyPair> getClientIdentities(SessionContext session) throws IOException, GeneralSecurityException
Description copied from interface:ClientIdentityProvider
Provides aKeyPair
representing the client identity- Specified by:
getClientIdentities
in interfaceClientIdentityProvider
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).- Returns:
- The client identities - may be
null
/empty if no currently available identity from this provider. Note: the provider may return a different value every time this method is called - e.g., if it is (re-)loading contents from a file. - Throws:
IOException
- If failed to load the identityGeneralSecurityException
- If failed to parse the identity
-
reloadClientIdentities
protected Iterable<KeyPair> reloadClientIdentities(SessionContext session, Path path) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
-