cn.home1.oss.lib.security.internal.preauth.PreAuthTokenCookieClearingLogoutHandler Maven / Gradle / Ivy
package cn.home1.oss.lib.security.internal.preauth;
import cn.home1.oss.lib.security.api.GenericUser;
import cn.home1.oss.lib.webmvc.api.TypeSafeCookie;
import lombok.NonNull;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* see: {@link org.springframework.security.web.authentication.logout.LogoutFilter}.
*
* Created by zhanghaolun on 16/7/6.
*/
public class PreAuthTokenCookieClearingLogoutHandler implements LogoutHandler {
@Qualifier(GenericUser.GENERIC_USER_COOKIE)
@Autowired(required = false)
@Setter
@NonNull
private TypeSafeCookie cookie;
@Override
public void logout( //
final HttpServletRequest request, //
final HttpServletResponse response, //
final Authentication authentication //
) {
if (this.cookie != null) {
this.cookie.clearCookie(request, response);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy