package com.crm.login.rely.backend.interceptor;

import com.crm.rely.backend.aspect.ControllerAop;
import com.crm.rely.backend.core.constant.Constants;
import com.crm.rely.backend.core.constant.PrefixEnum;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.entity.login.InfoEntity;
import com.crm.rely.backend.service.RedisService;
import com.crm.rely.backend.util.AESUtil;
import com.crm.rely.backend.util.InteceptorResultUtil;
import com.google.common.base.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

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

public class LoginExcludeInterceptor implements HandlerInterceptor {
    @Autowired
    private RedisService redisService;

    public LoginExcludeInterceptor() {

    }

    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
        httpServletRequest.getHeader(Constants.ACCESS_TOKEN);

        HeaderMapRequestWrapper  requestWrapper = new HeaderMapRequestWrapper(httpServletRequest);
        requestWrapper.removeHeader(Constants.ACCESS_TOKEN);
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {

    }
}
