Class CachingPublicKeyAuthenticator
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.auth.pubkey.CachingPublicKeyAuthenticator
- All Implemented Interfaces:
PublickeyAuthenticator
public class CachingPublicKeyAuthenticator
extends AbstractLoggingBean
implements PublickeyAuthenticator
Caches the result per session - compensates for
OpenSSH behavior where it sends 2 requests with the same key
(see SSHD-300).- Author:
- Apache MINA SSHD Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PublickeyAuthenticatorstatic final AttributeRepository.AttributeKey<Map<PublicKey, Boolean>> TheAttributeKeyused to store the cached authentication results on the session instanceFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
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.resolveCachedResults(String username, PublicKey key, ServerSession session)
-
Field Details
-
CACHE_ATTRIBUTE
TheAttributeKeyused to store the cached authentication results on the session instance -
authenticator
-
-
Constructor Details
-
CachingPublicKeyAuthenticator
-
-
Method Details
-
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
-
resolveCachedResults
-