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 org.apache.sshd.common.util.logging.AbstractLoggingBean implements PublickeyAuthenticator
Checks against a Collection of AuthorizedKeyEntrys Records the matched entry under a session attribute.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.common.config.keys.AuthorizedKeyEntry>
     

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Constructor
    Description
    AuthorizedKeyEntriesPublickeyAuthenticator(Object id, ServerSession session, Collection<? extends org.apache.sshd.common.config.keys.AuthorizedKeyEntry> entries, org.apache.sshd.common.config.keys.PublicKeyEntryResolver fallbackResolver)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    authenticate(String username, PublicKey key, ServerSession session)
    Checks whether the given PublicKey is allowed to be used for authenticating user "username" in a session.
     
    protected boolean
    matchesPrincipals(org.apache.sshd.common.config.keys.AuthorizedKeyEntry entry, String username, org.apache.sshd.common.config.keys.OpenSshCertificate cert, ServerSession session)
     
     

    Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • AUTHORIZED_KEY

      public static final org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.common.config.keys.AuthorizedKeyEntry> AUTHORIZED_KEY
  • Constructor Details

  • Method Details

    • getId

      public Object getId()
      Returns:
      Some kind of mnemonic identifier for the authenticator - used also in toString()
    • 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
    • matchesPrincipals

      protected boolean matchesPrincipals(org.apache.sshd.common.config.keys.AuthorizedKeyEntry entry, String username, org.apache.sshd.common.config.keys.OpenSshCertificate cert, ServerSession session)
    • toString

      public String toString()
      Overrides:
      toString in class Object