Package net.smoofyuniverse.ore
Class SessionManager
java.lang.Object
net.smoofyuniverse.ore.SessionManager
A manager for the session.
-
Constructor Summary
ConstructorsConstructorDescriptionSessionManager(URL authenticationUrl, String apiKey, com.google.gson.Gson gson) Creates a session manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidAuthenticates and stores a new session token.Gets the expiration instant of the current session.Gets the session token.Gets the current session token.
-
Constructor Details
-
SessionManager
Creates a session manager.- Parameters:
authenticationUrl- The authentication endpoint.apiKey- The API key.gson- The Gson.
-
-
Method Details
-
getExpiration
Gets the expiration instant of the current session.- Returns:
- The expiration instant.
-
getSession
Gets the current session token.- Returns:
- The session token.
-
getOrCreateSession
Gets the session token. If uninitialized or outdated, a new token is created.- Returns:
- The session token.
- Throws:
IOException- if an I/O error occurs.
-
authenticate
Authenticates and stores a new session token.- Throws:
IOException- if an I/O error occurs.
-