public class OpenSshCertificateAuthenticationProvider extends java.lang.Object implements PublicKeyAuthenticationProvider
| Constructor and Description |
|---|
OpenSshCertificateAuthenticationProvider(java.util.Collection<SshPublicKey> caPublicKeys) |
OpenSshCertificateAuthenticationProvider(SshPublicKey... caPublicKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(SshPublicKey key,
java.lang.String comment,
SshConnection con) |
void |
addCAKey(SshPublicKey caKey) |
boolean |
checkKey(SshPublicKey key,
SshConnection con) |
java.util.Iterator<SshPublicKeyFile> |
getKeys(SshConnection con) |
boolean |
isAuthorizedKey(SshPublicKey key,
SshConnection con)
Check the supplied public key against the users authorized keys.
|
void |
remove(SshPublicKey key,
SshConnection con) |
void |
removeKey(SshPublicKey caKey) |
public OpenSshCertificateAuthenticationProvider(SshPublicKey... caPublicKey)
public OpenSshCertificateAuthenticationProvider(java.util.Collection<SshPublicKey> caPublicKeys)
public void addCAKey(SshPublicKey caKey) throws SshException
SshExceptionpublic void removeKey(SshPublicKey caKey)
public boolean isAuthorizedKey(SshPublicKey key, SshConnection con) throws java.io.IOException
PublicKeyAuthenticationProvider
Check the supplied public key against the users authorized keys. The
actual verification of the key is performed by the server, you only need
to return a value to indicate whether the key is authorized or not. You
can obtain the username, home directory, group or remote socket address
from the com.sshtools.common.auth.server.PasswordAuthenticationProvider
instance.
If your authorized key database is kept on the native file system you can
obtain and initialize an instance as follows:
NativeFileSystemProvider nfs = (NativeFileSystemProvider) authenticationProvider
.getContext().getFileSystemProvider().newInstance();
nfs.init(sessionid, null, authenticationProvider.getContext());
Don't forget to close any file handles and the file system
once you've done accessing files.isAuthorizedKey in interface PublicKeyAuthenticationProviderkey - SshPublicKeycon - connectionjava.io.IOExceptionpublic java.util.Iterator<SshPublicKeyFile> getKeys(SshConnection con) throws PermissionDeniedException, java.io.IOException
getKeys in interface PublicKeyAuthenticationProviderPermissionDeniedExceptionjava.io.IOExceptionpublic void remove(SshPublicKey key, SshConnection con) throws java.io.IOException, PermissionDeniedException, SshException
remove in interface PublicKeyAuthenticationProviderjava.io.IOExceptionPermissionDeniedExceptionSshExceptionpublic void add(SshPublicKey key, java.lang.String comment, SshConnection con) throws java.io.IOException, PermissionDeniedException, SshException
add in interface PublicKeyAuthenticationProviderjava.io.IOExceptionPermissionDeniedExceptionSshExceptionpublic boolean checkKey(SshPublicKey key, SshConnection con) throws java.io.IOException
checkKey in interface PublicKeyAuthenticationProviderjava.io.IOExceptionCopyright © 2022. All rights reserved.