public class AuthorizedKeysPublicKeyAuthenticationProvider extends AbstractPublicKeyAuthenticationProvider
This class implements the OpenSSH style authorized_keys public key store.
Modifier and Type | Field and Description |
---|---|
protected String |
authorizedKeysFile
The path relative to the users home directory from which to load
authorized keys
|
Constructor and Description |
---|
AuthorizedKeysPublicKeyAuthenticationProvider()
Create a default authorized_keys store that reads keys from
.ssh/authorized_keys.
|
AuthorizedKeysPublicKeyAuthenticationProvider(String authorizedKeysFile)
Create an authorized keys stores that reads keys from a custom location.
|
Modifier and Type | Method and Description |
---|---|
void |
add(SshPublicKey key,
String comment,
Connection con) |
protected AbstractFile |
getFile(Connection connection) |
Iterator<SshPublicKeyFile> |
getKeys(Connection con) |
void |
init(String[] args) |
boolean |
isAuthorizedKey(SshPublicKey key,
Connection con)
Checks the given public key by comparing it against the public keys
stored in the users authorized_keys file.
|
void |
remove(SshPublicKey key,
Connection con) |
getName
protected String authorizedKeysFile
public AuthorizedKeysPublicKeyAuthenticationProvider()
public AuthorizedKeysPublicKeyAuthenticationProvider(String authorizedKeysFile)
authorizedKeysFile
- Stringpublic void init(String[] args)
public boolean isAuthorizedKey(SshPublicKey key, Connection con)
key
- SshPublicKeysessionid
- byte[]authenticationProvider
- AuthenticationProviderpublic void add(SshPublicKey key, String comment, Connection con) throws IOException, PermissionDeniedException, SshException
public void remove(SshPublicKey key, Connection con) throws IOException, PermissionDeniedException, SshException
public Iterator<SshPublicKeyFile> getKeys(Connection con) throws PermissionDeniedException, IOException
PermissionDeniedException
IOException
protected AbstractFile getFile(Connection connection) throws PermissionDeniedException, IOException
PermissionDeniedException
IOException
Copyright © 2024. All rights reserved.