I'm trying to implement a simple session management mechanism in GWT, and I'm still not quite sure if I got it right:
- First, in
onModuleLoad
, I check if asessionID
cookie exists. If it exists, I call the server to see if it is still valid. If it is, I return aUser
object which contains the sessionID and full username (I need this within my application). - If it doesn't exist, I diplay a
Login
dialog. The user enters username and password. I call myAuthenticationService
, check if the username + password is valid, then return aUser
object. The sessionID gets stored the cookie. - When loggin out, I delete the
sessionID
cookie.
This is how the sessionID gets created:
String sessionID = UUID.randomUUID().toString();
Is this so far correct?