Commit 795e6ac5 authored by Quxl's avatar Quxl

x

parent 51d4d191
......@@ -88,6 +88,7 @@ public class AdminTokenServiceImpl implements AdminTokenService {
HttpSession session = WebMvcConfig.getSession();
session.removeAttribute(TOKEN_NAME);
session.invalidate();
WebMvcConfig.getOrCreateUUIDCookie(LOGINID_COOKIE_NAME, "/", 60*60*24*5, true);
}
@Override
......
......@@ -119,6 +119,23 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return cookie;
}
public static void removeCookie(String name, String path) {
HttpServletRequest request = WebMvcConfig.getRequest();
HttpServletResponse response = WebMvcConfig.getResponse();
if(request != null) {
Cookie[] cookies = request.getCookies();
if(cookies != null) {
for(Cookie cookie : cookies) {
if(cookie.getName().equals(name)) {
cookie.setMaxAge(0);
cookie.setValue(null);
response.addCookie(cookie);
}
}
}
}
}
public static String getRemoteIp() {
HttpServletRequest request = WebMvcConfig.getRequest();
String ip = request.getHeader("X-Real_IP");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment