1 |
51049
|
argiro.kok
|
package eu.dnetlib.uoaadmintools;
|
2 |
|
|
|
3 |
56383
|
k.triantaf
|
import eu.dnetlib.uoaadmintools.configuration.properties.SecurityConfig;
|
4 |
51049
|
argiro.kok
|
import eu.dnetlib.uoaadmintools.handlers.AuthorizationHandler;
|
5 |
|
|
import org.apache.log4j.Logger;
|
6 |
56383
|
k.triantaf
|
import org.springframework.beans.factory.annotation.Autowired;
|
7 |
51049
|
argiro.kok
|
import org.springframework.context.annotation.Bean;
|
8 |
|
|
import org.springframework.context.annotation.Configuration;
|
9 |
|
|
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
10 |
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
11 |
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
12 |
|
|
|
13 |
|
|
/**
|
14 |
|
|
* Created by argirok on 23/2/2018.
|
15 |
|
|
*/
|
16 |
|
|
|
17 |
|
|
@Configuration
|
18 |
|
|
public class UoaAdminToolsConfiguration extends WebMvcConfigurerAdapter {
|
19 |
|
|
private final Logger log = Logger.getLogger(this.getClass());
|
20 |
|
|
|
21 |
56383
|
k.triantaf
|
@Autowired
|
22 |
|
|
private SecurityConfig securityConfig;
|
23 |
51049
|
argiro.kok
|
|
24 |
|
|
|
25 |
|
|
@Bean
|
26 |
|
|
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
27 |
|
|
return new PropertySourcesPlaceholderConfigurer();
|
28 |
|
|
}
|
29 |
|
|
|
30 |
53671
|
argiro.kok
|
@Override
|
31 |
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
32 |
56383
|
k.triantaf
|
registry.addInterceptor(new AuthorizationHandler(securityConfig.getUserInfoUrl(), securityConfig.getOriginServer(), securityConfig.getPostsAllowed()))
|
33 |
53671
|
argiro.kok
|
.addPathPatterns("/**");
|
34 |
51049
|
argiro.kok
|
|
35 |
53671
|
argiro.kok
|
}
|
36 |
|
|
|
37 |
51049
|
argiro.kok
|
}
|