public class SessionID extends Object implements Serializable
SessionID
class is used to identify a Session object. It
contains a random String and the name of the session server. The random
String in the Session ID is unique on a given session server.Session
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected String |
sessionDomain |
static String |
SHANDLE_SCHEME_PREFIX |
Constructor and Description |
---|
SessionID()
Creates a default instance of SessionID with a null Session ID.
|
SessionID(javax.servlet.http.HttpServletRequest request)
Constructs a
SessionID object based on a
HttpServletRequest object. but if cookie is not found it
checks the URL for session ID. |
SessionID(String sid)
Constructs a
SessionID object based on a Session ID. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Compares this Session ID to the specified object.
|
static String |
generateAmCtxID(SessionServerConfig serverConfig) |
SessionID |
generateRelatedSessionID(SessionServerConfig serverConfig) |
String |
generateSessionHandle(SessionServerConfig serverConfig) |
static SessionID |
generateSessionID(SessionServerConfig serverConfig,
String domain)
Generates new SessionID
|
static SessionID |
generateStatelessSessionID(SessionServerConfig serverConfig,
String domain,
String jwt)
Generates a new stateless session ID.
|
boolean |
getComingFromAuth()
This method returns the boolean representing if this session id
is a regular auth token, generated via AuthContext API
and not a restricted one.
|
Boolean |
getCookieMode()
Returns the if the cookies are supported.
|
SessionIDExtensions |
getExtension()
Retrieves extension value by name Currently used session id extensions
are
SessionService.SITE_ID server id (from platform server list)
hosting this session (in failover mode this will be server id of the
load balancer)
SessionService.PRIMARY_ID ,
SessionService.SECONDARY_ID used if internal request
routing mode is enabled. |
String |
getSessionDomain()
Gets the domain where this session belongs to.
|
String |
getSessionServer()
Gets the session server name in this object.
|
String |
getSessionServerID()
Gets the session server id in this object.
|
String |
getSessionServerPort()
Gets the session server port in this object
|
String |
getSessionServerProtocol()
Returns the session server name in this object.
|
String |
getSessionServerURI()
Returns the session server path in this object.
|
String |
getSessionServerURL()
Returns the session server URL in this object.
|
String |
getTail()
Returns tail part of session id
|
int |
hashCode()
Returns a hash code for this object.
|
boolean |
isC66Encoded()
Determines whether the session ID is c66 encoded or not.
|
boolean |
isNull()
Checks if encrypted string is null or empty
|
boolean |
isSessionHandle() |
static String |
makeRelatedSessionID(String encryptedID,
SessionID prototype)
Generates encoded session id string which uses the same extensions and
tail part as prototype session id, but a different encrypted ID.
|
void |
setComingFromAuth(boolean comingFromAuth)
This method sets the boolean representing if this session id
is a regular auth token, generated via AuthContext API
|
protected void |
setServerID(String id)
Sets the server info by making a naming request by passing
its id which is in session id and parses it.
|
String |
toString()
Returns the encrypted session string.
|
void |
validate()
This method validates that the received session ID points to an existing server ID, and the site ID also
corresponds to the server ID found in the session.
|
public static final String SHANDLE_SCHEME_PREFIX
protected String sessionDomain
public SessionID(javax.servlet.http.HttpServletRequest request)
SessionID
object based on a
HttpServletRequest
object. but if cookie is not found it
checks the URL for session ID.request
- HttpServletRequest
object which contains
the encrypted session string.public SessionID()
public SessionID(String sid)
SessionID
object based on a Session ID.sid
- The session ID String in an encrypted format.public boolean isNull()
public String getSessionServerURI()
public String getSessionServerURL()
public boolean getComingFromAuth()
public void setComingFromAuth(boolean comingFromAuth)
comingFromAuth
- boolean representing if the
token has been generated by AuthContext and is a regular token,
not restricted one.public String getSessionServerProtocol()
public String getSessionServerPort()
public String getSessionServer()
public String getSessionDomain()
public String getSessionServerID()
public String toString()
toString
in class Object
JSONSerialisation
public boolean equals(Object object)
public int hashCode()
protected void setServerID(String id)
id
- ServerIDpublic String getTail()
public Boolean getCookieMode()
TRUE if
supported FALSE
otherwise
public SessionIDExtensions getExtension()
SessionService.SITE_ID
server id (from platform server list)
hosting this session (in failover mode this will be server id of the
load balancer)
SessionService.PRIMARY_ID
,
SessionService.SECONDARY_ID
used if internal request
routing mode is enabled.public static String makeRelatedSessionID(String encryptedID, SessionID prototype) throws SessionException
encryptedID
- encrypted ID.prototype
- session ID to copy extensions and tail fromSessionException
public boolean isC66Encoded()
true
if the session ID is non-null and c66-encoded.Constants.C66_ENCODE_AM_COOKIE
public SessionID generateRelatedSessionID(SessionServerConfig serverConfig) throws SessionException
SessionException
public boolean isSessionHandle()
public String generateSessionHandle(SessionServerConfig serverConfig) throws SessionException
SessionException
public static String generateAmCtxID(SessionServerConfig serverConfig)
public static SessionID generateSessionID(SessionServerConfig serverConfig, String domain) throws SessionException
serverConfig
- Required server configurationdomain
- session domainSessionException
public static SessionID generateStatelessSessionID(SessionServerConfig serverConfig, String domain, String jwt) throws SessionException
serverConfig
- Required server configuration.domain
- session domain.jwt
- the stateless session JWT.SessionException
- if an error occurs encoding the session ID.public void validate() throws SessionException
SessionException
- If the validation failed, possibly because the provided session ID was malformed or not
created within this OpenAM deployment.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.