Class AbstractUserAuth

All Implemented Interfaces:
UserAuth, ClientSessionHolder, UserAuthInstance<ClientSession>, NamedResource
Direct Known Subclasses:
UserAuthHostBased, UserAuthKeyboardInteractive, UserAuthPassword, UserAuthPublicKey

public abstract class AbstractUserAuth extends AbstractLoggingBean implements UserAuth
  • Field Details

    • name

      private final String name
    • clientSession

      private ClientSession clientSession
    • service

      private String service
    • cancellable

      private boolean cancellable
  • Constructor Details

    • AbstractUserAuth

      protected AbstractUserAuth(String name)
  • Method Details

    • getClientSession

      public ClientSession getClientSession()
      Specified by:
      getClientSession in interface ClientSessionHolder
      Returns:
      The underlying ClientSession used
    • getSession

      public ClientSession getSession()
      Specified by:
      getSession in interface UserAuthInstance<ClientSession>
      Returns:
      The current session for which the authentication is being tracked. Note: may be null if the instance has not been initialized yet
    • getName

      public final String getName()
      Specified by:
      getName in interface NamedResource
      Returns:
      The resource name
    • getService

      public String getService()
    • isCancellable

      public boolean isCancellable()
      Description copied from interface: UserAuth
      Tells whether the authentication protocol is cancellable currently.
      Specified by:
      isCancellable in interface UserAuth
      Returns:
      true if the protocol can be canceled at its current state; false if not.
    • setCancellable

      protected void setCancellable(boolean cancellable)
      Sets whether the authentication protocol is currently cancellable.
      Parameters:
      cancellable - true if the protocol may be canceled in its current state; false if not
    • init

      public void init(ClientSession session, String service) throws Exception
      Specified by:
      init in interface UserAuth
      Parameters:
      session - The ClientSession
      service - The requesting service name
      Throws:
      Exception - If failed to initialize the mechanism
    • process

      public boolean process(Buffer buffer) throws Exception
      Specified by:
      process in interface UserAuth
      Parameters:
      buffer - The Buffer to process - null if not a response buffer, i.e., the underlying authentication mechanism should initiate whatever challenge/response mechanism is required
      Returns:
      true if request handled - false if the next authentication mechanism should be used
      Throws:
      Exception - If failed to process the request
    • sendAuthDataRequest

      protected abstract boolean sendAuthDataRequest(ClientSession session, String service) throws Exception
      Throws:
      Exception
    • processAuthDataRequest

      protected abstract boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception
      Throws:
      Exception
    • destroy

      public void destroy()
      Description copied from interface: UserAuth
      Called to release any allocated resources
      Specified by:
      destroy in interface UserAuth
    • toString

      public String toString()
      Overrides:
      toString in class Object