public class DefaultAuthorizedKeysAuthenticator extends AuthorizedKeysAuthenticator implements UsernameHolder
~/.ssh/authorized_keys file of the user currently running the server, re-loading it if
necessary. It also (optionally) enforces the same permissions regime as OpenSSH does for the file
permissions. By default also compares the current username with the authenticated one.| Modifier and Type | Field and Description |
|---|---|
static DefaultAuthorizedKeysAuthenticator |
INSTANCE
The default instance that enforces the same permissions regime as
OpenSSH |
STD_AUTHORIZED_KEYS_FILENAMEoptions, STRICTLY_PROHIBITED_FILE_PERMISSIONlog| Constructor and Description |
|---|
DefaultAuthorizedKeysAuthenticator(boolean strict) |
DefaultAuthorizedKeysAuthenticator(Path path,
boolean strict,
LinkOption... options) |
DefaultAuthorizedKeysAuthenticator(String user,
boolean strict) |
DefaultAuthorizedKeysAuthenticator(String user,
Path path,
boolean strict,
LinkOption... options) |
| Modifier and Type | Method and Description |
|---|---|
String |
getUsername() |
boolean |
isStrict() |
protected boolean |
isValidUsername(String username,
ServerSession session) |
protected Collection<AuthorizedKeyEntry> |
reloadAuthorizedKeys(Path path,
String username,
ServerSession session) |
protected Path |
validateFilePath(Path path,
Collection<PosixFilePermission> perms,
Collection<PosixFilePermission> excluded) |
authenticate, createDelegateAuthenticator, getDefaultAuthorizedKeysFile, getFallbackPublicKeyEntryResolver, readDefaultAuthorizedKeys, resolvePublickeyAuthenticatorcheckReloadRequired, exists, getPath, lastModified, resetReloadAttributes, size, toPathResource, toPathResource, toString, updateReloadAttributes, validateStrictConfigFilePermissionsdebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfromAuthorizedEntriespublic static final DefaultAuthorizedKeysAuthenticator INSTANCE
OpenSSHpublic DefaultAuthorizedKeysAuthenticator(boolean strict)
strict - If true then makes sure that the containing folder has 0700 access and the file 0600.
Note: for Windows it does not check these permissionspublic DefaultAuthorizedKeysAuthenticator(String user, boolean strict)
public DefaultAuthorizedKeysAuthenticator(Path path, boolean strict, LinkOption... options)
public DefaultAuthorizedKeysAuthenticator(String user, Path path, boolean strict, LinkOption... options)
public final String getUsername()
getUsername in interface UsernameHolderpublic final boolean isStrict()
protected boolean isValidUsername(String username, ServerSession session)
isValidUsername in class AuthorizedKeysAuthenticatorprotected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException, GeneralSecurityException
reloadAuthorizedKeys in class AuthorizedKeysAuthenticatorIOExceptionGeneralSecurityExceptionprotected Path validateFilePath(Path path, Collection<PosixFilePermission> perms, Collection<PosixFilePermission> excluded) throws IOException
path - The Path to be validatedperms - The current PosixFilePermissionsexcluded - The permissions not allowed to existIOException - If an excluded permission appears in the current onesCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.