package cn.reghao.oss.console.account.security.handler;

import cn.reghao.oss.console.account.service.AccountAuthService;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

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

    public LogoutHandlerImpl(AccountAuthService accountAuthService) {
        this.accountAuthService = accountAuthService;
    }

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