public class UniversalAuthenticationProvider extends Object implements PublicKeyAuthenticationProvider
| Constructor and Description |
|---|
UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase) |
UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase,
String hostname) |
UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase,
String hostname,
int port) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(SshPublicKey key,
String comment,
Connection con) |
Iterator<SshPublicKeyFile> |
getKeys(Connection con) |
boolean |
isAuthorizedKey(SshPublicKey key,
Connection con)
Check the supplied public key against the users authorized keys.
|
void |
remove(SshPublicKey key,
Connection con) |
public UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase)
public UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase, String hostname)
public UniversalAuthenticationProvider(UniversalAuthenticatorAccountDatabase accountDatabase, String hostname, int port)
public boolean isAuthorizedKey(SshPublicKey key, Connection con) throws 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.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 - connectionIOExceptionpublic Iterator<SshPublicKeyFile> getKeys(Connection con) throws PermissionDeniedException, IOException
getKeys in interface PublicKeyAuthenticationProviderPermissionDeniedExceptionIOExceptionpublic void remove(SshPublicKey key, Connection con) throws IOException, PermissionDeniedException, SshException
remove in interface PublicKeyAuthenticationProviderIOExceptionPermissionDeniedExceptionSshExceptionpublic void add(SshPublicKey key, String comment, Connection con) throws IOException, PermissionDeniedException, SshException
add in interface PublicKeyAuthenticationProviderIOExceptionPermissionDeniedExceptionSshExceptionCopyright © 2025. All rights reserved.