Class AuthorizedKeyEntriesPublickeyAuthenticator
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.auth.pubkey.AuthorizedKeyEntriesPublickeyAuthenticator
- All Implemented Interfaces:
PublickeyAuthenticator
public class AuthorizedKeyEntriesPublickeyAuthenticator
extends AbstractLoggingBean
implements PublickeyAuthenticator
Checks against a
Collection of AuthorizedKeyEntrys
Records the matched entry under a session attribute.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AttributeRepository.AttributeKey<AuthorizedKeyEntry> private Objectprivate Map<AuthorizedKeyEntry, PublicKey> Fields inherited from class AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionAuthorizedKeyEntriesPublickeyAuthenticator(Object id, ServerSession session, Collection<? extends AuthorizedKeyEntry> entries, PublicKeyEntryResolver fallbackResolver) -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(String username, PublicKey key, ServerSession session) Checks whether the givenPublicKeyis allowed to be used for authenticating user "username" in a session.getId()protected booleanmatchesExpiryTime(String username, ServerSession session, String expiryTime) protected booleanmatchesFrom(String username, ServerSession session, String from) protected booleanmatchesLoginOptions(AuthorizedKeyEntry entry, String username, ServerSession session) protected booleanmatchesPrincipals(AuthorizedKeyEntry entry, String username, OpenSshCertificate cert, ServerSession session) protected InstantparseExpiryTime(String expiryTime) protected InetSocketAddressresolveClientAddress(ServerSession session) toString()
-
Field Details
-
AUTHORIZED_KEY
-
resolvedKeys
-
id
-
-
Constructor Details
-
AuthorizedKeyEntriesPublickeyAuthenticator
public AuthorizedKeyEntriesPublickeyAuthenticator(Object id, ServerSession session, Collection<? extends AuthorizedKeyEntry> entries, PublicKeyEntryResolver fallbackResolver) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
-
Method Details
-
getId
- Returns:
- Some kind of mnemonic identifier for the authenticator - used also in
toString()
-
authenticate
Description copied from interface:PublickeyAuthenticatorChecks whether the givenPublicKeyis allowed to be used for authenticating user "username" in a session.Note that the
keymay be aOpenSshCertificate. A typical implementation for a certificate would check that the certificate's CA key is known to be trusted as a certificate authority, and that the given user name is listed in the certificate's principals.- Specified by:
authenticatein interfacePublickeyAuthenticator- Parameters:
username- the usernamekey- the keysession- the server session- Returns:
trueif the key may be used;falseotherwise
-
matchesLoginOptions
protected boolean matchesLoginOptions(AuthorizedKeyEntry entry, String username, ServerSession session) -
matchesExpiryTime
-
parseExpiryTime
-
matchesFrom
-
resolveClientAddress
-
matchesPrincipals
protected boolean matchesPrincipals(AuthorizedKeyEntry entry, String username, OpenSshCertificate cert, ServerSession session) -
toString
-