Reputation: 62145
I'm trying to implement a simple session management mechanism in GWT, and I'm still not quite sure if I got it right:
onModuleLoad
, I check if a sessionID
cookie exists. If it exists, I call the server to see if it is still valid. If it is, I return a User
object which contains the sessionID and full username (I need this within my application).Login
dialog. The user enters username and password. I call my AuthenticationService
, check if the username + password is valid, then return a User
object. The sessionID gets stored the cookie.sessionID
cookie.This is how the sessionID gets created:
String sessionID = UUID.randomUUID().toString();
Is this so far correct?
Upvotes: 1
Views: 14793
Reputation: 3587
In my GWT application, I want to establish a session on the client side. For this purpose, I created a timer and for each and every navigation event I check the Timer. If the timer's time limit is exceeded then I render the Login Panel. For detailed code See this
Upvotes: 0
Reputation: 51
No need to have a timer, just set cookie expiration on the client. In general, each client request within the allowed "active" time frame should both update the cookie's expiration (shift it forward) and server side session expiration (!important).
Upvotes: 1
Reputation: 3609
This might help too. I have gone with your method too, where I needed much wider user access control. Also you should take a look at SSL. Go with a method that suits your needs.
Upvotes: 2