package com.persagy.dmp.auth.config;

import com.persagy.dmp.common.context.AppContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * 鉴权组件的Feign调用拦截器
 * @author : lijie
 * Update By 2022/1/11 14:47
 */
@Configuration
@Slf4j
public class AuthFeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        // 添加token
        template.header("token", AppContext.getContext().getToken());
    }
}