This is simple and safe, as a cookie with a session area is signed with a private key. If there is no need to store a large amount of data for each session, this should be OK.
Take a look at existing solutions (e.g. zentasks sample).
Edit
On the other hand, you can consider using Play Authenticate, I added session processing for an example in my fork (branch 2.0.4_session) to samples / java / play-authenticate-usage , these are just 3 commits, so itβs quite simple to combine it with existing play-authenticate-usage implementation.
source share