Пример #1
0
 /*
  * (non-Javadoc)
  *
  * @see
  * cc.kune.core.client.cookies.CookiesManager#setAuthCookie(java.lang.String)
  */
 @Override
 public void setAuthCookie(final String userHash) {
   // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ
   final Date expires = new Date(System.currentTimeMillis() + SessionConstants.SESSION_DURATION);
   Cookies.setCookie(
       SessionConstants.USERHASH,
       userHash,
       expires,
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
   Cookies.setCookie(
       SessionConstants.JSESSIONID,
       userHash,
       expires,
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
   Log.info("Received hash: " + userHash, null);
 }
Пример #2
0
 /*
  * (non-Javadoc)
  *
  * @see cc.kune.core.client.cookies.CookiesManager#removeAuthCookie()
  */
 @Override
 public void removeAuthCookie() {
   // FIXME: Remove cookie doesn't works in all browsers, know
   // issue:
   // http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ded86778ee56690/515dc513c7d085eb?lnk=st&q=remove+cookie#515dc513c7d085eb
   // http://code.google.com/p/google-web-toolkit/issues/detail?id=1735&q=removeCookie
   Cookies.removeCookie(SessionConstants.USERHASH);
   Cookies.removeCookie(SessionConstants.JSESSIONID);
   // Workaround:
   Cookies.setCookie(
       SessionConstants.USERHASH,
       null,
       new Date(0),
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
   Cookies.setCookie(
       SessionConstants.JSESSIONID,
       null,
       new Date(0),
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
 }