Interface Authenticator


public interface Authenticator
An authenticator.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    default Optional<String>
    Returns the the id of the client type for which to use this authenticator.
    default void
    Disposes of all resources used by this authenticator, after a call to this method the authenticator should be regarded as unusable.
    login(RemoteClient remoteClient)
    Performs login validation for the user specified by the remote client and returns a remote client with the same clientId and user but possibly a different databaseUser to propagate to further login procedures
    default void
    logout(RemoteClient remoteClient)
    Called after the given client has been disconnected
  • Method Details

    • clientTypeId

      default Optional<String> clientTypeId()
      Returns the the id of the client type for which to use this authenticator. If none is specified, this authenticator is shared between all clients.
      Returns:
      the String identifying the client type for which to use this authenticator or an empty optional in case this authenticator should be shared
    • login

      RemoteClient login(RemoteClient remoteClient) throws LoginException
      Performs login validation for the user specified by the remote client and returns a remote client with the same clientId and user but possibly a different databaseUser to propagate to further login procedures
      Parameters:
      remoteClient - the client
      Returns:
      a new client with the same clientId but not necessarily the same user or databaseUser
      Throws:
      LoginException - in case the login fails
      See Also:
    • logout

      default void logout(RemoteClient remoteClient)
      Called after the given client has been disconnected
      Parameters:
      remoteClient - the remote client
    • close

      default void close()
      Disposes of all resources used by this authenticator, after a call to this method the authenticator should be regarded as unusable. This method should be called by a server using this authenticator on shutdown, giving the authenticator a chance to release resources in an orderly manner. Any exception thrown by this method is ignored.
    • authenticators

      static List<Authenticator> authenticators()
      Returns:
      a list containing all the authenticators registered with ServiceLoader.