Project

General

Profile

1
package eu.dnetlib.uoaadmintools;
2

    
3
import eu.dnetlib.uoaadmintools.handlers.AuthorizationHandler;
4
import org.apache.log4j.Logger;
5
import org.springframework.beans.factory.annotation.Value;
6
import org.springframework.context.annotation.Bean;
7
import org.springframework.context.annotation.Configuration;
8
import org.springframework.context.annotation.PropertySource;
9
import org.springframework.context.annotation.PropertySources;
10
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
11
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
12
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
13

    
14
/**
15
 * Created by argirok on 23/2/2018.
16
 */
17

    
18
@Configuration
19
public class UoaAdminToolsConfiguration extends WebMvcConfigurerAdapter {
20
    private final Logger log = Logger.getLogger(this.getClass());
21

    
22
@Value( "${admintool.userInfoUrl}" )
23
private String userInfoUrl = null;
24

    
25
    @Value( "${admintool.originServer}" )
26
    private String originServer= null;
27

    
28
    @Bean
29
    public static PropertySourcesPlaceholderConfigurer  propertySourcesPlaceholderConfigurer() {
30
        return new PropertySourcesPlaceholderConfigurer();
31
    }
32

    
33
    @Override
34
    public void addInterceptors(InterceptorRegistry registry) {
35
        registry.addInterceptor(new AuthorizationHandler(userInfoUrl,originServer))
36
                .addPathPatterns("/**");
37

    
38
    }
39

    
40
}
(3-3/3)