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:
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:
- The
DefaultSessionConfigurator
default implementation stores user info on the server. - The
JwtSessionConfigurator
implementation generates self contained JWT (JSON Web Tokens) and there is no info storage on the server.
- 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 idint
getSessionTimelifeMinutes()
Allows to define the sessions lifetime in minutesString
getUsername(String sessionId)
Loads the username stored for the passed session idvoid
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
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 implementationDefaultSessionConfigurator
.- Parameters:
username
- the username to store for the passed session iddatabase
- 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
Loads the username stored for the passed session id- Parameters:
sessionId
- the session id- Returns:
- the username stored for the passed session Id
-
getDatabase
Loads the database stored for the passed session id- Parameters:
sessionId
- the session id- Returns:
- the database stored for the passed session Id
-
remove
Removes storage for the passed session Id. Method is called by AceQL when client side callslogout
- Parameters:
sessionId
- the session id
-
verifySessionId
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
Allows to define the sessions lifetime in minutes- Returns:
- the sessions lifetime in minutes
- Throws:
IOException
- if any I/O error
-