Interface SessionConfigurator

All Known Implementing Classes:
DefaultSessionConfigurator, JwtSessionConfigurator

public interface SessionConfigurator
Interface that defines how to generate and verify session id for (username, database) sessions.

Interface implementation allows to:
  • Define how to generate a session id after client /connect call.
  • Define the sessions lifetime.
  • Define how to verify that the stored session is valid and not expired.

Two implementations are provided:

Author:
Nicolas de Pomereu
  • Method Summary

    Modifier and Type Method Description
    String generateSessionId​(String username, String database)
    Generates a unique session id for the (username, database) couple.
    String getDatabase​(String sessionId)
    Loads the database stored for the passed session id
    int getSessionTimelifeMinutes()
    Allows to define the sessions lifetime in minutes
    String getUsername​(String sessionId)
    Loads the username stored for the passed session id
    void remove​(String sessionId)
    Removes storage for the passed session Id.
    boolean verifySessionId​(String sessionId)
    Verify that this session id corresponds to an existing and is still valid (non expired).
  • Method Details

    • generateSessionId

      String generateSessionId​(String username, String database) throws IOException
      Generates a unique session id for the (username, database) couple. The session id is used to authenticate clients calls that pass it at each http call.

      Method may be also use to store in server memory the (username, database) couple for the generated session id. This is done in the default implementation DefaultSessionConfigurator.
      Parameters:
      username - the username to store for the passed session id
      database - the database to store for the passed session id
      Returns:
      a unique session id for the (username, database) couple.
      Throws:
      IOException - if any I/O error
    • getUsername

      String getUsername​(String sessionId)
      Loads the username stored for the passed session id
      Parameters:
      sessionId - the session id
      Returns:
      the username stored for the passed session Id
    • getDatabase

      String getDatabase​(String sessionId)
      Loads the database stored for the passed session id
      Parameters:
      sessionId - the session id
      Returns:
      the database stored for the passed session Id
    • remove

      void remove​(String sessionId)
      Removes storage for the passed session Id. Method is called by AceQL when client side calls logout
      Parameters:
      sessionId - the session id
    • verifySessionId

      boolean verifySessionId​(String sessionId) throws IOException
      Verify that this session id corresponds to an existing and is still valid (non expired).
      Parameters:
      sessionId - the session id to verify
      Returns:
      true if the sessionId is valid
      Throws:
      IOException - if any I/O error
    • getSessionTimelifeMinutes

      int getSessionTimelifeMinutes() throws IOException
      Allows to define the sessions lifetime in minutes
      Returns:
      the sessions lifetime in minutes
      Throws:
      IOException - if any I/O error