Class LdapPasswordAuthenticator

java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.net.NetworkConnector
org.apache.sshd.ldap.LdapNetworkConnector<org.apache.sshd.server.session.ServerSession>
org.apache.sshd.ldap.LdapAuthenticator
org.apache.sshd.ldap.LdapPasswordAuthenticator
All Implemented Interfaces:
org.apache.sshd.server.auth.password.PasswordAuthenticator

public class LdapPasswordAuthenticator extends LdapAuthenticator implements org.apache.sshd.server.auth.password.PasswordAuthenticator
Uses LDAP to authenticate a user and password. By default it can achieve this using 2 ways:

  1. Comparing the provided password with the one stored in LDAP. In this case, the bind DN and password patterns can be either empty (if anonymous access allowed) or can contain the administrative username / password required to run the LDAP query. The search filter pattern should be set to require a match for both the username and password - e.g., "(invalid input: '&'(user={0})(password={1}))". The set default (DEFAULT_SEARCH_FILTER_PATTERN) uses the most commonly encountered attributes names for this purpose.
  2. Using the original username + password to access LDAP - in which case the very success of retrieving anything can be considered a successful authentication. In this case, the bind DN and password patterns should be set up to generate the correct credentials - the default is to "echo" the provided username and password as-is. E.g., if the username is always the alias part of a known e-mail, the bind DN should be set to "{0}@my.domain.com".
  • Field Details

  • Constructor Details

    • LdapPasswordAuthenticator

      public LdapPasswordAuthenticator()
  • Method Details

    • authenticate

      public boolean authenticate(String username, String password, org.apache.sshd.server.session.ServerSession session) throws org.apache.sshd.server.auth.password.PasswordChangeRequiredException
      Specified by:
      authenticate in interface org.apache.sshd.server.auth.password.PasswordAuthenticator
      Throws:
      org.apache.sshd.server.auth.password.PasswordChangeRequiredException
    • authenticate

      protected boolean authenticate(String username, String password, org.apache.sshd.server.session.ServerSession session, Map<String,?> attrs)