Class AbstractUserAuth

All Implemented Interfaces:
UserAuthInstance<ServerSession>, UsernameHolder, NamedResource, UserAuth, ServerSessionHolder
Direct Known Subclasses:
UserAuthGSS, UserAuthHostBased, UserAuthKeyboardInteractive, UserAuthNone, UserAuthPassword, UserAuthPublicKey

public abstract class AbstractUserAuth extends AbstractLoggingBean implements UserAuth
Author:
Apache MINA SSHD Project
  • Constructor Details

    • AbstractUserAuth

      protected AbstractUserAuth(String name)
  • Method Details

    • getName

      public final String getName()
      Specified by:
      getName in interface NamedResource
    • getUsername

      public String getUsername()
      Specified by:
      getUsername in interface UsernameHolder
    • getService

      public String getService()
    • getServerSession

      public ServerSession getServerSession()
      Specified by:
      getServerSession in interface ServerSessionHolder
      Returns:
      The underlying ServerSession used
    • getSession

      public ServerSession getSession()
      Specified by:
      getSession in interface UserAuthInstance<ServerSession>
    • auth

      public Boolean auth(ServerSession session, String username, String service, Buffer buffer) throws Exception
      Description copied from interface: UserAuth
      Try to authenticate the user. This methods should return a non null value indicating if the authentication succeeded. If the authentication is still ongoing, a null value should be returned.
      Specified by:
      auth in interface UserAuth
      Parameters:
      session - the current ServerSession session
      username - the user trying to log in
      service - the requested service name
      buffer - the request buffer containing parameters specific to this request
      Returns:
      true if the authentication succeeded, false if the authentication failed and null if not finished yet
      Throws:
      AsyncAuthException - if the service is willing to perform an asynchronous authentication
      Exception - if the authentication fails
    • next

      public Boolean next(Buffer buffer) throws Exception
      Description copied from interface: UserAuth
      Handle another step in the authentication process.
      Specified by:
      next in interface UserAuth
      Parameters:
      buffer - the request buffer containing parameters specific to this request
      Returns:
      true if the authentication succeeded, false if the authentication failed and null if not finished yet
      Throws:
      AsyncAuthException - if the service is willing to perform an asynchronous authentication
      Exception - if the authentication fails
    • destroy

      public void destroy()
      Description copied from interface: UserAuth
      Free any system resources used by the module.
      Specified by:
      destroy in interface UserAuth
    • doAuth

      protected abstract Boolean doAuth(Buffer buffer, boolean init) throws Exception
      Throws:
      Exception
    • toString

      public String toString()
      Overrides:
      toString in class Object