Update1:
Could you give me a small example of how to manage cookies and sessions in play2? (remember me)
Ok, I think I understand the basic concept of replay authentication.
Zentasks uses sessions. I know that sessions are only stored on the server. And the sessions in play2 are already signed. Cookies are not.
What if users want to log in, even if it closes the browser?
I will need to use a cookie.
What should I do?
Create a cookie that creates a session?
eg
- User has a valid cookie.
- get cookie val and create a new session
Or I completely cancel the sessions and instead use only cookies. Since the cookie does not automatically sign play2, I have to do it myself, which I did.
response().setCookie("remember",Crypto.sign(rnd) + "-" + obj.getClass().getName() + "-" + rnd,12000);
(I know that I have not yet protected it with secure and only http flags)
I just don't want to invent a new and damaged system. I hope you can understand how to make authentication secure in play2.
source share