Create IgnoreSecurityConfiguration and move WebMvcConfigurer to AuthorizationConfiguration.
This commit is contained in:
parent
78ad75ca3f
commit
93fd8a651b
|
@ -2,8 +2,24 @@ package eu.dnetlib.uoaauthorizationlibrary.configuration;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.*;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties({SecurityConfig.class, GlobalVars.class})
|
@EnableConfigurationProperties({SecurityConfig.class, GlobalVars.class})
|
||||||
@ComponentScan(basePackages = { "eu.dnetlib.uoaauthorizationlibrary" })
|
@ComponentScan(basePackages = { "eu.dnetlib.uoaauthorizationlibrary" })
|
||||||
public class AuthorizationConfiguration { }
|
public class AuthorizationConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebMvcConfigurer corsConfigurer() {
|
||||||
|
return new WebMvcConfigurerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
|
||||||
|
.allowCredentials(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package eu.dnetlib.uoaauthorizationlibrary.configuration;
|
||||||
|
|
||||||
|
import eu.dnetlib.uoaauthorizationlibrary.security.AuthorizationService;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan(
|
||||||
|
basePackageClasses = {AuthorizationService.class}
|
||||||
|
)
|
||||||
|
public class IgnoreSecurityConfiguration {
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
package eu.dnetlib.uoaauthorizationlibrary.security;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class CorsConfig extends WebMvcConfigurerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
|
||||||
registry.addMapping("/**")
|
|
||||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
|
|
||||||
.allowCredentials(true);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue