예제 #1
0
 public static void removeToken(
     HttpServletRequest request, HttpServletResponse response, String name) {
   Cookie cookie = CookieUtil.getCookie(request, name);
   cookie.setMaxAge(0);
   cookie.setValue(null);
   CookieUtil.addCookie(response, cookie);
 }
예제 #2
0
 public static void saveToken(
     HttpServletRequest request, HttpServletResponse response, String name, String token) {
   if (StringUtil.isBlank(token)) {
     return;
   }
   try {
     token = AESUtil.encryptBase64(secKey, token);
     token = URLEncoder.encode(token, CharsetConstant.UTF_8);
     Cookie secCookie = new Cookie(name, token);
     secCookie.setPath(SymbolConstant.SLASH);
     CookieUtil.addCookie(response, secCookie);
   } catch (Exception e) {
     logger.error("Save Cookie failure!", e);
   }
 }