我这样做了:
用户登录并查看place1中的Remember-me框。
用户登录并不选中place2中的Remember-me框 相同帐户,然后用户退出。
有一个问题:
PersistentTokenBasedRememberMeServices
)。我想这样做:
我该如何解决这个问题?
答案 0 :(得分:0)
我做了如下,并且说得好!
public class MyRememberMeService extends PersistentTokenBasedRememberMeServices {
public MyRememberMeService(String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) {
super(key, userDetailsService, tokenRepository);
}
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie == null || rememberMeCookie.length() == 0) {
if (logger.isDebugEnabled()) {
logger.debug("Logout of user "
+ (authentication == null ? "Unknown" : authentication.getName()));
}
cancelCookie(request, response);
} else {
super.logout(request, response, authentication);
}
}
}