public final class LunaSessionManager
extends java.lang.Object
Constructor and Description |
---|
LunaSessionManager() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheAuthorizedSession(int slotNum,
LunaTokenObject obj,
LunaSession session)
Cache the provided session
|
static boolean |
closeAllCachedSessions()
Close all cached sessions on all logged-in slots.
|
static boolean |
closeAllSessions()
Close all sessions sitting in the cache as well as all active sessions on all logged-in slots.
|
static boolean |
closeAllSessions(int slotNum)
Close all sessions sitting in the cache as well as all active sessions on the specified slot.
|
static boolean |
closeCachedSessions()
Close all cached sessions on the default slot.
|
static boolean |
closeCachedSessions(int slotNum)
Close all cached sessions on the specified slot.
|
static void |
deleteCachedAuthorizedSession(int slotNum,
LunaTokenObject obj)
delete a cached authorized session on the specified slot.
|
static void |
forceAllHSMSessionsToClose()
Close all sessions open against all currently logged-in slots, then log out of the slots.
|
static void |
forceAllHSMSessionsToClose(int slot)
Close all sessions open against the specified logged-in slot, then log out of the slot.
|
static void |
free(LunaSession session)
Free the given session.
|
static int |
getActiveSessionCount()
Returns the number of sessions currently open and in-use on the default slot.
|
static int |
getActiveSessionCount(int slotNum)
Returns the number of sessions currently open and in-use on the specified slot.
|
static LunaSession |
getCachedAuthorizedSession(int slotNum,
LunaTokenObject obj)
Get a cached session authorized on the specified slot.
|
static int |
getCachedSessionCount()
Returns the number of sessions currently cached for the default slot.
|
static int |
getCachedSessionCount(int slotNum)
Returns the number of sessions currently cached for the specified slot.
|
static LunaSession |
getSession()
Get a new session on the current default active slot.
|
static LunaSession |
getSession(int slotNum)
Get a new session on the specified slot.
|
static LunaSession |
getSession(LunaKey key)
Get a new session on the same slot as the specified key.
|
static int |
getSessionCount()
Returns the number of sessions currently open on the default slot.
|
static int |
getSessionCount(int slotNum)
Returns the number of sessions currently open on the specified slot.
|
static LunaSession |
getSessionForAuthorization(int slotNum,
LunaTokenObject obj)
Get a new session for authorization on the specified slot.
|
static int |
getTotalSessionCount()
Returns the number of sessions currently open on all slots used by this application.
|
static boolean |
isSessionAuthorized(LunaKey key) |
public static int getTotalSessionCount()
public static int getSessionCount()
public static int getSessionCount(int slotNum)
slotNum
- Check the token in this slot numberpublic static int getActiveSessionCount()
public static int getActiveSessionCount(int slotNum)
slotNum
- Check the token in this slot numberpublic static int getCachedSessionCount()
public static int getCachedSessionCount(int slotNum)
slotNum
- Check the token in this slot numberpublic static LunaSession getSession()
LunaException
- There is no logged in slot availablepublic static LunaSession getSession(int slotNum)
slotNum
- The slot to get a session onLunaException
- The user is not logged in to the slot that the session is requested onpublic static LunaSession getSessionForAuthorization(int slotNum, LunaTokenObject obj)
slotNum
- The slot to get a session onobj
- The LunaTokenObject to get a session forLunaException
- The user is not logged in to the slot that the session is requested onpublic static LunaSession getCachedAuthorizedSession(int slotNum, LunaTokenObject obj)
slotNum
- The slot to get a session onobj
- The LunaTokenObject to get a session forLunaException
- The user is not logged in to the slot that the session is requested onpublic static void cacheAuthorizedSession(int slotNum, LunaTokenObject obj, LunaSession session)
slotNum
- The desired slotobj
- The LunaTokenObject to get a session forsession
- The LunaSession to cacheLunaException
- The user is not logged in to the slot that the session is requested onpublic static void deleteCachedAuthorizedSession(int slotNum, LunaTokenObject obj)
slotNum
- The desired slotobj
- The LunaTokenObject to get a session forLunaException
- The user is not logged in to the slot that the session is requested onpublic static LunaSession getSession(LunaKey key)
key
- A session is returned on the same slot as this slotpublic static boolean isSessionAuthorized(LunaKey key)
key
- A session is returned on the same slot as this slotpublic static void free(LunaSession session)
session
- The session to freepublic static boolean closeCachedSessions(int slotNum) throws LunaException
slotNum
- The slot number to close the sessions onLunaException
- The user in not logged in to the specified slotpublic static boolean closeCachedSessions() throws LunaException
LunaException
- The user in not logged in to the specified slotpublic static boolean closeAllCachedSessions()
public static boolean closeAllSessions(int slotNum)
Use of this function can be dangerous and can cause operations in other threads to fail. This functionality is provided for your convenience but it is strongly recommended to find an alternative solution.
slotNum
- Check the token in this slot numberpublic static boolean closeAllSessions()
Use of this function can be dangerous and can cause operations in other threads to fail. This functionality is provided for your convenience but it is strongly recommended to find an alternative solution.
public static void forceAllHSMSessionsToClose(int slot)
Use of this function can be dangerous and will cause operations in other threads and / or applications to fail. This functionality is provided as a convenience but we strongly advise against its use. The operation will be performed on the currently managed slot
slot
- Check the token in this slot numberLunaException
- exceptionpublic static void forceAllHSMSessionsToClose() throws LunaException
This function is intended only to clean up the HSM if the Java application is abnormally terminated. Use of this function while the application is running will cause all current operations to fail.
This functionality is provided as a convenience but we strongly advise against its use.
LunaException
- exceptionCopyright 2014-2018 SafeNet. All rights reserved.