package thyyxxk.webserver.config.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import thyyxxk.webserver.dao.his.LoginDao;

/**
 * @author dj
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    private final LoginDao dao;

    @Autowired
    public InterceptorConfig(LoginDao dao) {
        this.dao = dao;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthenticationInterceptor(dao))
                .addPathPatterns("/**");
    }
}
