WebMvcConfig.java 835 Bytes
package etunicorn;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * etunicorn-server
 * Copyright © 2017 Le Club Info Polytech Lille
 * Tous droits réservés
 */

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    // http://stackoverflow.com/a/18218439
    @Bean
    public SecurityInterceptor securityInterceptor() {
        return new SecurityInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new GitHeaderInterceptor());
        registry.addInterceptor(securityInterceptor());
    }
}