public class InternalSession extends Object implements Serializable, AMSession, SessionPersistenceObservable
InternalSession
class represents a Webtop internal session.
A session has four states: invalid, valid, inactive, and destroyed. The initial state of a session is invalid.
SessionState
,
Serialized FormModifier and Type | Field and Description |
---|---|
Properties |
sessionProperties |
Constructor and Description |
---|
InternalSession()
Default constructor required for deserialisation, and should not be used elsewhere.
|
InternalSession(SessionID sid)
Creates a new InternalSession with the given Session ID.
|
Modifier and Type | Method and Description |
---|---|
boolean |
activate(String userDN)
Changes the state of the session to ACTIVE after creation.
|
SessionID |
addRestrictedToken(SessionID newRestrictedTokenId,
TokenRestriction restriction)
Add new restricted token pointing at the same session to the list.
|
void |
addSessionEventURL(String url,
SessionID sid)
Adds a listener for the associated session ID.
|
void |
cacheCookieString(String cookieString)
Cache the cookie string.
|
void |
clearAuthContext()
Clears the authentication context from this session.
|
AuthContextLocal |
getAuthContext()
Get the authentication context associated with this session.
|
String |
getCachedCookieString()
Returns the cached cookie string for this InternalSession.
|
String |
getClientDomain()
Returns the Domain of the Client
|
String |
getClientID()
Returns Client ID, accessing this Internal Session.
|
boolean |
getCookieSupport()
Returns true if cookies are supported.
|
long |
getExpirationTime(TimeUnit timeUnit)
Computes session object expiration time as the smallest of the remaining idle time (or purge delay if the
session has already timed out) or the session lifetime limit.
|
SessionID |
getID()
Returns the SessionID of this Internal Session.
|
long |
getIdleTime()
Returns the time(in seconds) for which the Internal Session has not been
accessed.
|
boolean |
getIsSessionUpgrade()
Gets the status of the
Session if is an upgrade state |
long |
getMaxCachingTime()
Returns the maximum caching time(in minutes) allowed for the Internal
Session.
|
long |
getMaxIdleExpirationTime(TimeUnit timeUnit)
Returns time at which session's idle time expires.
|
long |
getMaxIdleTime()
Returns the maximum idle time(in minutes) for the Internal Session.
|
long |
getMaxSessionExpirationTime(TimeUnit timeUnit)
Returns time at which session's lifetime expires.
|
long |
getMaxSessionTime()
Returns maximum time allowed for the Internal Session.
|
Object |
getObject(String key)
Returns the value of the specified key from the internal object map.
|
String |
getProperty(String key)
Returns the value of the specified key from the Internal Session property
table.
|
Enumeration |
getPropertyNames()
Returns the Enumeration of property names of the Internal Session
property table.
|
SessionID |
getRestrictedTokenForRestriction(TokenRestriction restriction)
Returns the SessionID of the restricted token for the provided restriction for this session.
|
Set<SessionID> |
getRestrictedTokens()
Returns the set (possibly empty) of restricted session IDs associated with this session.
|
TokenRestriction |
getRestrictionForToken(SessionID sid)
Returns the TokenRestriction for the given SessionID.
|
Map<String,Set<SessionID>> |
getSessionEventURLs()
Returns the URL of the Session events and the associated master and
restricted token ids.
|
String |
getSessionHandle()
Returns the session handle.
|
SessionID |
getSessionID()
Return the SessionID object which represents this InternalSession.
|
SessionState |
getState()
Returns the state of the Internal Session
|
long |
getTimeLeft()
Returns the total time left(in seconds) for the Internal Session.
|
SessionType |
getType()
Returns the type of Internal Session.
|
String |
getUUID()
Gets the User Universal ID
|
boolean |
hasAuthenticationContext()
Gets whether this session has an associated authenticationContext.
|
boolean |
isAppSession()
Determine whether it is an application session.
|
boolean |
isInvalid() |
static boolean |
isProtectedProperty(String key)
Helper method to check if a property is protected or not.
|
boolean |
isStored()
Returns whether the InternalSession represented has been stored.
|
boolean |
isTimedOut()
Returns true if the session has timed out due to idle/max timeout period.
|
boolean |
isUserSession()
Determine whether it is a user session.
|
void |
notifyPersistenceManager() |
void |
putExternalProperty(SSOToken clientToken,
String key,
String value)
Sets the key-value pair in the InternalSession property table if it is
not protected.
|
void |
putProperty(String key,
String value)
Sets the key-value pair in the Internal Session property table.
|
void |
removeObject(String key)
Removes the mapping for this key from the internal object map if present.
|
void |
setAuthContext(AuthContextLocal authContext)
Sets the authentication context.
|
void |
setClientDomain(String domain)
Sets the Clieant's Domain.
|
void |
setClientID(String id)
Sets Client ID for this Internal Session.
|
void |
setCookieMode(Boolean cookieMode)
set the cookieMode based on whether the request has cookies or not.
|
void |
setCreationTime()
Sets the creation time of the Internal Session, as the number of seconds
since midnight January 1, 1970 GMT.
|
void |
setDebug(Debug debug)
The debug instance is not restored during deserialisation.
|
void |
setIsSessionUpgrade(boolean value)
Sets the status of the isSessionUpgrade flag to which determines if the
Session is in the upgrade state or not. |
void |
setLatestAccessTime()
Sets the last time the client sent a request associated with this
session, as the number of seconds since midnight January 1, 1970 GMT.
|
void |
setMaxCachingTime(long t)
Sets the maximum caching time(in minutes) for the Internal Session.
|
void |
setMaxIdleTime(long maxIdleTimeInMinutes)
Sets the maximum idle time (in minutes) for the Internal Session.
|
void |
setMaxSessionTime(long maxSessionTimeInMinutes)
Sets the maximum time (in minutes) allowed for the Internal Session
|
void |
setNonExpiring()
Sets the willExpireFlag.
|
void |
setObject(String key,
Object value)
Sets the key-value pair in the internal object map.
|
void |
setPersistenceManager(SessionPersistenceManager manager)
Set the manager which handles persistence of this observable.
|
void |
setSessionHandle(String sessionHandle)
Used during session deserialization.
|
void |
setSessionServiceDependencies(SessionService service,
SessionServiceConfig serviceConfig,
InternalSessionEventBroker internalSessionEventBroker,
SessionUtilsWrapper sessionUtilsWrapper,
SessionConstraint sessionConstraint,
Debug debug)
The SessionService is not restored during deserialisation.
|
void |
setState(SessionState sessionState)
Sets the
SessionState of the Internal Session. |
void |
setTimedOutTime(long timeoutTime)
Sets session timeout time (in millis).
|
void |
setType(SessionType type)
Set the type of Internal Session.
|
SessionInfo |
toSessionInfo() |
SessionInfo |
toSessionInfo(boolean withIds)
Transfers the info about the Internal Session to Session Info.
|
String |
toString() |
boolean |
willExpire()
Returns the value of willExpireFlag.
|
public Properties sessionProperties
public InternalSession(SessionID sid)
sid
- SessionID Non null Session ID.public InternalSession()
setSessionServiceDependencies(SessionService, SessionServiceConfig,
InternalSessionEventBroker, SessionUtilsWrapper, SessionConstraint, Debug)
public void setDebug(Debug debug)
debug
- Non null debug instance.public void setSessionServiceDependencies(SessionService service, SessionServiceConfig serviceConfig, InternalSessionEventBroker internalSessionEventBroker, SessionUtilsWrapper sessionUtilsWrapper, SessionConstraint sessionConstraint, Debug debug)
service
- Non null SessionService.public SessionID getID()
public SessionType getType()
USER
or APPLICATION
.public void setType(SessionType type)
type
- USER
or APPLICATION
.public String getClientID()
public void setClientID(String id)
id
- public String getClientDomain()
public void setClientDomain(String domain)
domain
- Client Domainpublic long getMaxSessionTime()
public void setMaxSessionTime(long maxSessionTimeInMinutes)
maxSessionTimeInMinutes
- Maximum Session Timepublic long getMaxIdleTime()
public void setMaxIdleTime(long maxIdleTimeInMinutes)
maxIdleTimeInMinutes
- public long getMaxCachingTime()
public void setMaxCachingTime(long t)
t
- Maximum Caching Timepublic long getIdleTime()
public long getTimeLeft()
public boolean isTimedOut()
true
if the Internal session has timedout ,
false
otherwisepublic void cacheCookieString(String cookieString)
cookieString
- The cookie string to persist.public String getCachedCookieString()
public SessionID getSessionID()
public SessionState getState()
public AuthContextLocal getAuthContext()
public boolean hasAuthenticationContext()
public void setAuthContext(AuthContextLocal authContext)
authContext
- the authentication contextpublic void clearAuthContext()
public String getProperty(String key)
key
- Property keypublic Enumeration getPropertyNames()
public static boolean isProtectedProperty(String key)
key
- property name.public void putExternalProperty(SSOToken clientToken, String key, String value) throws SessionException
clientToken
- Token of the client setting external property.key
- Property keyvalue
- Property value for the keySessionException
- is thrown if the key is protected property.public void putProperty(String key, String value)
key
- Property keyvalue
- Property value for the keypublic void setIsSessionUpgrade(boolean value)
Session
is in the upgrade state or not.value
- true
if it is an upgrade
false
otherwisepublic boolean getIsSessionUpgrade()
Session
if is an upgrade statetrue
if the session is in upgrade state
false
otherwisepublic boolean isStored()
true
if the internal session is stored
false
otherwisepublic boolean activate(String userDN)
userDN
- true
if the session is successfully activated
after creation , false
otherwisepublic String getUUID()
public void setNonExpiring()
public void setTimedOutTime(long timeoutTime)
timeoutTime
- The timeout time (in millis).public SessionInfo toSessionInfo()
public SessionInfo toSessionInfo(boolean withIds)
public void setLatestAccessTime()
public void setState(SessionState sessionState)
SessionState
of the Internal Session.sessionState
- public Map<String,Set<SessionID>> getSessionEventURLs()
public void addSessionEventURL(String url, SessionID sid)
url
- The listening URL.sid
- The associated SessionID.public boolean willExpire()
public boolean isAppSession()
true
if this is an application session, false
otherwise.public boolean isUserSession()
true
if this is a user session, false
otherwise.public void setCreationTime()
public SessionID addRestrictedToken(SessionID newRestrictedTokenId, TokenRestriction restriction)
newRestrictedTokenId
- The session ID.restriction
- The token restriction.public TokenRestriction getRestrictionForToken(SessionID sid)
sid
- Possibly null SessionID.public SessionID getRestrictedTokenForRestriction(TokenRestriction restriction)
restriction
- restriction used to look up restricted token.public Set<SessionID> getRestrictedTokens()
TokenRestriction
is satisfied. Typically this ties a particular
user session to only be used via a particular agent or from a particular IP address.
The result is a copy of the current restricted token set: modifications to it will not change the set of restricted tokens associated with the session.
public boolean getCookieSupport()
public void setCookieMode(Boolean cookieMode)
cookieMode
- ,
Boolean value whether request has cookies or not.public void setSessionHandle(String sessionHandle)
sessionHandle
- The sessionHandle to set.public String getSessionHandle()
public long getExpirationTime(TimeUnit timeUnit)
Time value is returned in the requested unit (accurate to millisecond) and uses the
same epoch as System.currentTimeMillis()
.
timeUnit
- the time unit to return the result in.public long getMaxSessionExpirationTime(TimeUnit timeUnit)
Time value is returned in the requested unit (accurate to millisecond) and uses the
same epoch as System.currentTimeMillis()
.
timeUnit
- the time unit to return the result in.getMaxSessionTime()
public long getMaxIdleExpirationTime(TimeUnit timeUnit)
Time value is returned in the requested unit (accurate to millisecond) and uses the
same epoch as System.currentTimeMillis()
.
timeUnit
- the time unit to return the result in.getMaxIdleTime()
public boolean isInvalid()
public void setPersistenceManager(SessionPersistenceManager manager)
SessionPersistenceObservable
setPersistenceManager
in interface SessionPersistenceObservable
manager
- The manager to add.public void notifyPersistenceManager()
public Object getObject(String key)
key
- the key whose associated value is to be returnedpublic void removeObject(String key)
key
- key whose mapping is to be removed from the mapCopyright © 2010–2025 Open Identity Platform Community. All rights reserved.