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 tokenCode: 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
}
Cyclos Version is 4.15.5