Class SessionManager
java.lang.Object
com.developer.nefarious.zjoule.plugin.auth.SessionManager
Manages the user's session within the application.
The
SessionManager
class provides static methods for login, logout,
and session state verification. It interacts with various memory components
and the browser to manage user sessions.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears all active sessions, including both SAP and Ollama sessions.static boolean
Checks if an Ollama session is active by verifying required memory components.static boolean
Checks if an SAP session is active by verifying required memory components.static boolean
Checks if the user is logged in by verifying both SAP and Ollama sessions.static void
login
(org.eclipse.swt.browser.Browser browser) Executes the login process using the specified browser.static void
logout
(org.eclipse.swt.browser.Browser browser, EclipseMemory eclipseMemory) Executes the logout process using the specified browser and clears all memory.
-
Method Details
-
isUserLoggedIn
public static boolean isUserLoggedIn()Checks if the user is logged in by verifying both SAP and Ollama sessions.- Returns:
true
if the user is logged into either SAP or Ollama,false
otherwise.
-
isSapSession
public static boolean isSapSession()Checks if an SAP session is active by verifying required memory components.- Returns:
true
if all required SAP session components are present,false
otherwise.
-
isOllamaSession
public static boolean isOllamaSession()Checks if an Ollama session is active by verifying required memory components.- Returns:
true
if all required Ollama session components are present,false
otherwise.
-
login
public static void login(org.eclipse.swt.browser.Browser browser) Executes the login process using the specified browser. This method triggers the `login()` JavaScript function in the browser and updates the associated tags using theTagHandler
.- Parameters:
browser
- theBrowser
instance to execute the login process.
-
logout
Executes the logout process using the specified browser and clears all memory. The method triggers the `logout()` JavaScript function in the browser and clears all user-related data from theEclipseMemory
.- Parameters:
browser
- theBrowser
instance to execute the logout process. If the browser is null or disposed, no JavaScript execution occurs.eclipseMemory
- theEclipseMemory
instance used to clear all memory.
-
clearAllSessions
public static void clearAllSessions()Clears all active sessions, including both SAP and Ollama sessions.
-