Storing user data server-side in a session

Enonic version: 7.0.1
OS: Win10


I’m in the process of creating an enonic id provider geared towards OpenID Connect. After a user is authenticated I want to store the tokens somewhere to keep them available from any controller / app. Is this possible? It would be optimal if the token could be stored and tied to the session of the user somehow.

I saw an old discuss thread which is somewhat related "Global" or session object from a while back

Any recommendations for how to solve this?


1 Like

To store data about a user in a persistent way:
authLib.getProfile and authLib.modifyProfile

To store data in the session.
There is no library method for this but it is doable using Java.
Example: How to call a script bean from JS
Example: How to get the current request
Example: How to store/retrieve session attributes


I have shared a library here, to interact with the user session: