How can i use mongodb as session storage

Hi all,

i plan to use mongodb as my session storage database. i noticed that the session data in mongodb is encrypted. is there got anyone able to use mongodb as external session storage? is there any success case i can read as a reference?
Any help would be appreciated.

some of the setting of my Application.cfc as below

this.name = "backendTest"; //hash(getCurrentTemplatePath())
this.applicationTimeout = CreateTimeSpan(10, 0, 0, 0); //10 days
this.sessionManagement = true;
this.sessiontimeout = CreateTimeSpan(0,0,0,10);
this.sessionStorage = "lucee_session";
this.sessionCluster = true; 
this.sessionType = "application";
this.SetClientCookies = false;

session data in mongodb

{
	_id:59b8a4470a5bc1a1ad9de8e8
	createdOn:1505272905712
	timeIdle:10000
	hits:1
	expires:0
	data:"rO0ABXVyAANbW0JL/RkVZ2fbNwIAAHhwAAAAAnVyAAJbQqzzF/gGCFTgAgAAeHAAAAQJrO..."
	key:"lucee-storage:session:574dfaba-fd36-49a9-b01f-092720722252:backendtest"
	lastAccessed:1505272905712
	lastUpdated:1505272905712
}

It’s not encrypted, it’s serialized. You can look at the java implementation of the cache to see how to deserialize it.

thanks for your prompt response. can you give me some URL for me to read cause i’m new for java.

It looks like the deserialize method of the lucee.runtime.converter.JavaConverter class is being used.

1 Like