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 org.apache.sshd.common.util.logging.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 Details

    • CACHE_ATTRIBUTE

      public static final org.apache.sshd.common.AttributeRepository.AttributeKey<Map<PublicKey, Boolean>> CACHE_ATTRIBUTE
      The AttributeKey used to store the cached authentication results on the session instance
    • authenticator

      protected final PublickeyAuthenticator authenticator
  • Constructor Details

  • Method Details

    • authenticate

      public boolean authenticate(String username, PublicKey key, ServerSession session)
      Description copied from interface: PublickeyAuthenticator
      Checks whether the given PublicKey is allowed to be used for authenticating user "username" in a session.

      Note that the key may be a OpenSshCertificate. 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:
      authenticate in interface PublickeyAuthenticator
      Parameters:
      username - the username
      key - the key
      session - the server session
      Returns:
      true if the key may be used; false otherwise
    • resolveCachedResults

      protected Map<PublicKey, Boolean> resolveCachedResults(String username, PublicKey key, ServerSession session)