Ceptor has the concept of a session - in this session, we store known data about a particular user/client/browser/device.

A session always has a session ID which references it - this ID can be in the "new" or the "old" format - the old format is a fixed length format with space for limited data, and the new format is variable length with space for containing more data.
A session can also have a token or ticket pointing to it - this could be a JWT token, an SSL client certificate, an eticket or any other kind of ticker or token previously issued to a user.

A Unique ID is unique per request, and contains both a Session ID part, and a Request ID part - the Request ID is not part of the key for the session itself, but a unique string appended to the session ID creating the "Unique ID" which is forwarded on each request to the proxied Destinations. The Request part of the ID carries data such as the current IP address and TCP port number of the request, along with environment and channel ID.

Obtaining Sessions

When the Ceptor Gateway obtains a session, it invokes a Session Resolver - a Session Resolver is responsible for looking at the request, and identifying a session from the request. A session can be identified using a number of different methods and attributes, such as a plain session cookie, but it can also be based upon an API Key, an HTTP header value, a bearer token or any other form of token or ticket or ID which identifies the client/callers session in some form.

The session ID / ticket / token is mapped to a session by calling Ceptor Agent (embedded in the gateway) which makes a call to the Ceptor Session Controller in order to obtain a reference to a session.

The session itself (while initially containing nothing) is over time populated with information about the caller, such as userid, groups and attributes such as name, address or even haircolor, shoesize or whatever other attributes you want to store within the session. A session survives across requests and is potentially shared across many requests and gateways, applications and modules. Look at it as a kind of shared piece of memory containing attributes that in some form identifies or relates to the caller.

All sessions are stored on the Ceptor Session Controller and accessed via the API in the Ceptor Agent - the Agent is also responsible for caching content, and participates in a kind distributed shared cache.
Any changes to a session are always done solely by the Ceptor Session Controller - but changes are requested by many other modules via the Ceptor Agent API.

Creating a session from a token/ticket/attribute can involve authenticating the client - e.g. if a session is created from an API Key or an SSL Client Certificate, the creation of the session involves validating and authenticating the client.

Ceptor provices out-of-the-box support for the following Session Resolvers:

 It is possible to create your own ways of resolving a session using a different method, e.g. using a unique device ID sent by a client, using another format than a cookie to contain the session ID etc. Ceptor has a plugin architecture which allows you to create custom plugins to handle this. Refer to the documentation here: Plugins - SessionResolver For information on how to do this.

Session ID formats

"Old" ID format

 *  8 bytes Client Machine ID (IP)
 *  2 bytes cluster ID
 *  2 bytes segment ID
 * 28 bytes Session ID (random bytes + timestamp + counter)


The above is considered the session ID part of the ID, below is the request specific part of it
 *  2 bytes Transaction chn type
 *  8 bytes Transaction ID
 *  2 bytes Environment ID
 *  8 bytes Current IP address


"New" ID format

* 5 bytes "magic" identifier - either "PPID_" or "CEPID_"
* x bytes Session ID

The above is considered the session ID part of the ID, below is the request specific part of it
* 1 bytes seperator character - always "_"
* y bytes Request ID
The x/y bytes of Session/Request ID is in the format
* 2 bytes length
* 1 byte type (Currenty for sesssion ID: IP, RANDOM, CLUSTERID, SEGMENTID and for request ID: CHANNELID, ENVIRONMENTID, SOURCEIP, SOURCEPORT, TRANSACTIONID, OAUTHTOKEN)
* z bytes (defined by the first 2 bytes indicating the length) content

As you can see, the new format is dynamic in length and can be extended with other types of information, where the old format is fixed and is unable to carry more information.

The type of format used is configured in the Ceptor Session Controller - we recommend using the new format unless you have good reason not to.

WIth version 5.x the format was PPID_ and then a base64 encoded version of the session ID and of the transaction ID, separated by an underscore _

With version 6.x, the default format is CEPID_ and a base64 URLSafe encoded version of session ID and transaction ID separated by a tilde ~ - this makes the entire session ID contain only URL safe characters, which makes it easier to use in various REST clients, where some have issues with encoding the characters properly before sending.


Data as Part of ID

The IDs can carry limited data, here is a short description of the purpose of each data item;