I have a login page. I want to manage session and cookie in it. I am using GWT. Can any one suggest me how to do that. I din't find any good resource.
Asked
Active
Viewed 925 times
0
-
GWT has Cookies which gives access to browser cookies using something like com.google.gwt.user.client.Cookies.setCookie() and com.google.gwt.user.client.Cookies.getCookie(). Is there change to manage the session on the server side? – Euclides Jun 03 '16 at 14:56
2 Answers
0
On login create some session id token and save it in cookies. On page load in method onModuleLoad first of all load session id token from cookies and if exists check is token expired or not. If token does not exist or is expired - show login page. Otherwise load all required data according to token.
corsair
- 658
- 5
- 14
0
onModuleLoad, check if a sessionID cookie exists. If it doesnot exists, show the login screen/tab/dialog, once the user enters the credentials create the session for the user.
If cookie exists then check the cookie expiration time. If cookie is not valid, show the login screen/tab/dialog.
If cookie exists and having valid expiration time, then allow the user with his request and also update the expiration time in the cookie.
References:
Community
- 1
- 1
Clement Amarnath
- 5,301
- 1
- 21
- 34