Top Description Fields Constructors Methods
org.apache.sshd.server.config.keys

public Class DefaultAuthorizedKeysAuthenticator

extends AuthorizedKeysAuthenticator
implements UsernameHolder
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.auth.UsernameHolder
Imports
java.io.IOException, java.nio.file.FileSystemException, .LinkOption, .Path, java.nio.file.attribute.PosixFilePermission, java.security.GeneralSecurityException, java.util.Collection, .Collections, .Map, org.apache.sshd.common.auth.UsernameHolder, org.apache.sshd.common.config.keys.AuthorizedKeyEntry, .KeyUtils, org.apache.sshd.common.util.OsUtils, .ValidateUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.server.session.ServerSession

Monitors the ~/.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.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final DefaultAuthorizedKeysAuthenticator
INSTANCE

The default instance that enforces the same permissions regime as OpenSSH

private final boolean
private final String
Inherited from org.apache.sshd.server.config.keys.AuthorizedKeysAuthenticator:
STD_AUTHORIZED_KEYS_FILENAME

Constructor Summary

AccessConstructor and Description
public
DefaultAuthorizedKeysAuthenticator(boolean
If true then makes sure that the containing folder has 0700 access and the file 0600

Note

for Windows it does not check these permissions

strict
)

public
public
DefaultAuthorizedKeysAuthenticator(Path path, boolean strict, LinkOption... options)

public
DefaultAuthorizedKeysAuthenticator(String user, Path path, boolean strict, LinkOption... options)

Method Summary

Modifier and TypeMethod and Description
public final String
public final boolean
protected boolean
protected Collection<AuthorizedKeyEntry>
protected Path

Returns:

The original path
validateFilePath
(Path
The Path to be validated
path
,
Collection<PosixFilePermission>
The current PosixFilePermissions
perms
,
Collection<PosixFilePermission>
The permissions not allowed to exist
excluded
)

Inherited from org.apache.sshd.server.config.keys.AuthorizedKeysAuthenticator:
authenticatecreateDelegateAuthenticatorgetDefaultAuthorizedKeysFilegetFallbackPublicKeyEntryResolverreadDefaultAuthorizedKeysresolvePublickeyAuthenticator

Field Detail

INSTANCEback to summary
public static final DefaultAuthorizedKeysAuthenticator INSTANCE

The default instance that enforces the same permissions regime as OpenSSH

strictback to summary
private final boolean strict
userback to summary
private final String user

Constructor Detail

DefaultAuthorizedKeysAuthenticatorback to summary
public DefaultAuthorizedKeysAuthenticator(boolean strict)
Parameters
strict:boolean

If true then makes sure that the containing folder has 0700 access and the file 0600

Note

for Windows it does not check these permissions

DefaultAuthorizedKeysAuthenticatorback to summary
public DefaultAuthorizedKeysAuthenticator(String user, boolean strict)
DefaultAuthorizedKeysAuthenticatorback to summary
public DefaultAuthorizedKeysAuthenticator(Path path, boolean strict, LinkOption... options)
DefaultAuthorizedKeysAuthenticatorback to summary
public DefaultAuthorizedKeysAuthenticator(String user, Path path, boolean strict, LinkOption... options)

Method Detail

getUsernameback to summary
public final String getUsername()

Implements org.apache.sshd.common.auth.UsernameHolder.getUsername.

Returns:String

Doc from org.apache.sshd.common.auth.UsernameHolder.getUsername.

The attached username - may be null/empty if holder not yet initialized

Annotations
@Override
isStrictback to summary
public final boolean isStrict()
isValidUsernameback to summary
protected boolean isValidUsername(String username, ServerSession session)

Overrides org.apache.sshd.server.config.keys.AuthorizedKeysAuthenticator.isValidUsername.

Annotations
@Override
reloadAuthorizedKeysback to summary
protected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException, GeneralSecurityException

Overrides org.apache.sshd.server.config.keys.AuthorizedKeysAuthenticator.reloadAuthorizedKeys.

Annotations
@Override
validateFilePathback to summary
protected Path validateFilePath(Path path, Collection<PosixFilePermission> perms, Collection<PosixFilePermission> excluded) throws IOException
Parameters
path:Path

The Path to be validated

perms:Collection<PosixFilePermission>

The current PosixFilePermissions

excluded:Collection<PosixFilePermission>

The permissions not allowed to exist

Returns:Path

The original path

Exceptions
IOException:
If an excluded permission appears in the current ones