package cn.reghao.bnt.web.admin.security.handler;

import cn.reghao.bnt.web.admin.service.AccountLoginService;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.stereotype.Component;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
 * @author reghao
 * @date 2023-08-03 14:32:07
 */
@Component
public class LogoutHandlerImpl implements LogoutHandler {
    private final AccountLoginService accountLoginService;

    public LogoutHandlerImpl(AccountLoginService accountLoginService) {
        this.accountLoginService = accountLoginService;
    }

    @Override
    public void logout(HttpServletRequest request, HttpServletResponse response, Authentication auth) {
        accountLoginService.logout();
    }
}
