public class SessionManager extends BaseManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEC_PARM_TOKENIZER_CHAR |
static long |
TIMEOUT_VAL |
Modifier | Constructor and Description |
---|---|
protected |
SessionManager() |
Modifier and Type | Method and Description |
---|---|
static void |
extendSessionLifetime(WebSession session) |
static java.lang.String |
extractSecureParam(java.lang.String data)
If this is a valid secure param string, then extract the secure
param and return it.
|
static java.lang.String |
generateSessionKey(java.lang.String data)
Generates a session key for usage in passing sensitive
url based parameters around in a safe way.
|
static boolean |
isPxtSessionKeyValid(java.lang.String key)
Verifies that the specified string is a valid pxt session key.
|
static boolean |
isValidSecureParam(java.lang.String data)
Determine if this is a secure param as created by the other
methods on this class.
|
static void |
killSession(java.lang.String sessionKey)
Removes the session specified by sessionKey from the database.
|
static long |
lifetimeValue()
Return the lifetime in seconds of the Session.
|
static WebSession |
loadSession(java.lang.String sessionKey)
Returns the session identified by sessionKey
|
static WebSession |
lookupByKey(java.lang.String key)
Lookup a Session by it's key
|
static java.lang.String |
makeSecureParamNoTimestamp(java.lang.String data)
Create a secure param string without timestamp
|
static java.lang.String |
makeSecureParamTimestamped(java.lang.String data)
Create a secure param string with a timestamp for the current time.
|
static WebSession |
makeSession(java.lang.Long uid,
long duration)
Create a new Session from scratch with the specified attributes.
|
static void |
purgeUserSessions(User user)
Removes all the sessions of a user.
|
static int |
removeSession(WebSession s)
Removes the given session.
|
makeDataResult, makeDataResult, makeDataResult, makeDataResult, makeDataResultNoPagination, makeDataResultNoPagination, processListControl, processPageControl
public static final java.lang.String SEC_PARM_TOKENIZER_CHAR
public static final long TIMEOUT_VAL
public static long lifetimeValue()
public static WebSession makeSession(java.lang.Long uid, long duration)
uid
- User Id associated with this WebSessionduration
- duration of WebSession, in ms.public static int removeSession(WebSession s)
s
- WebSession to remove.public static WebSession loadSession(java.lang.String sessionKey)
sessionKey
- The key for the session that is requestedpublic static void killSession(java.lang.String sessionKey)
sessionKey
- Key for the session you want to remove.public static java.lang.String generateSessionKey(java.lang.String data)
data
- String data to generate key onpublic static java.lang.String makeSecureParamNoTimestamp(java.lang.String data)
data
- param to be securedpublic static java.lang.String makeSecureParamTimestamped(java.lang.String data)
data
- param to be secured.public static boolean isValidSecureParam(java.lang.String data)
data
- potentially secure param stringpublic static java.lang.String extractSecureParam(java.lang.String data)
data
- secure param stringpublic static boolean isPxtSessionKeyValid(java.lang.String key)
key
- The session key to be validatedtrue
if the key is valid. Note that null
is
acceptable input and will result in false
being returned.public static WebSession lookupByKey(java.lang.String key)
key
- The key containing the session id and hashpublic static void purgeUserSessions(User user)
user
- the user whose sessions are to be purged.public static void extendSessionLifetime(WebSession session)
session
- session which lifetime should be extended