ScriptStorage Handler Not Seems Expiring

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

ScriptStorage Handler Not Seems Expiring

Post by rajesh »

Hello Team,

We followed this https://documentation.cyclos.org/4.15/c ... types.html (4.3.8. Session handling) to have custom session validation. The basics of creating the token as JWT is excluded as it is out of scope for this problem statement.

Below is the shortened code for the "Script code to login users" part

Code: Select all

 def token = jwsObject.serialize()
 int timeout = variables.sessionTimeout.milliseconds / 1000
 println "timeout ${timeout}"
 def storage = scriptStorageHandler.get("session_${token}", timeout)
 storage.token = token
 return token
And Below is the code for "Script code to resolve a session given a token"

Code: Select all

 
 String sessionToken = binding.sessionToken
 def storage = scriptStorageHandler.getIfValid("session_${sessionToken}")
 if (storage != null) {
 def session = new Session()
 def channelService = variables.channelService as ChannelServiceImpl
 def channelToLoad = payload.channel ? payload.channel : 'main'
 def channel = channelService.load(channelToLoad as String)
 session.sessionToken = variables.sessionToken
 session.user = userOrOperator
 session.channel = channel
 return session
 } else {
  return null
  }
 
Though the session timeout is configured as 900 seconds (15 Minutes), the scriptStorage doesn't seem to have expired, and thus, if the logged-in user window opened even after couple of days, the session seems to be valid and they able to perform the operations.

Cyclos Version is 4.15.5
Post Reply