diff options
Diffstat (limited to 'common')
8 files changed, 113 insertions, 64 deletions
diff --git a/common/pom.xml b/common/pom.xml index f1541314ec..45359231d0 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -10,24 +10,18 @@ <artifactId>common</artifactId> <name>common</name> <description>MSO Common classes:- Logger</description> - <properties> <grpc.version>1.17.1</grpc.version> <protobuf.version>3.6.1</protobuf.version> <grpc.netty.version>4.1.30.Final</grpc.netty.version> <ccsdk.version>0.4.2</ccsdk.version> </properties> - <dependencies> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </dependency> @@ -61,14 +55,6 @@ <version>2.3.2</version> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> <scope>test</scope> @@ -181,7 +167,6 @@ <artifactId>proto-definition</artifactId> <version>${ccsdk.version}</version> </dependency> - <!-- protobuf dependencies --> <dependency> <groupId>com.google.protobuf</groupId> @@ -203,11 +188,6 @@ </dependency> <dependency> <groupId>io.grpc</groupId> - <artifactId>grpc-stub</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> <artifactId>grpc-netty</artifactId> <version>${grpc.version}</version> </dependency> @@ -225,7 +205,6 @@ <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-external-task-client</artifactId> - <version>1.4.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> @@ -297,11 +276,6 @@ <artifactId>validation-api</artifactId> </dependency> <dependency> - <groupId>javax.xml.bind</groupId> - <artifactId>jaxb-api</artifactId> - <version>2.3.0</version> - </dependency> - <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.3.0</version> @@ -319,7 +293,6 @@ <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> - <version>3.8.1</version> </dependency> </dependencies> <dependencyManagement> @@ -378,7 +351,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <id>tests-jar</id> diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java index 356c1cb4de..32ba36275e 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java @@ -43,6 +43,8 @@ public class NssmfRequest implements Serializable { private NetworkType networkType; + private String sST; + private Object additionalProperties; public NssmfRequest() {} @@ -56,8 +58,10 @@ public class NssmfRequest implements Serializable { this.additionalProperties = additionalProperties; this.serviceInstanceID = serviceInfo.getNssiId(); this.name = serviceInfo.getNssiName(); + this.sST = serviceInfo.getSST(); } + } diff --git a/common/src/main/java/org/onap/so/constants/Status.java b/common/src/main/java/org/onap/so/constants/Status.java index b460418f0f..67c5ff0d40 100644 --- a/common/src/main/java/org/onap/so/constants/Status.java +++ b/common/src/main/java/org/onap/so/constants/Status.java @@ -27,6 +27,7 @@ package org.onap.so.constants; public enum Status { PENDING, IN_PROGRESS, + WAIT_COMPLETION_NOTIF, COMPLETE, COMPLETED, FAILED, diff --git a/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java new file mode 100644 index 0000000000..f494a6b812 --- /dev/null +++ b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java @@ -0,0 +1,44 @@ +package org.onap.so.security; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.firewall.StrictHttpFirewall; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +public abstract class BaseWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { + private static final Logger LOGGER = LoggerFactory.getLogger(BaseWebSecurityConfigurerAdapter.class); + + @Autowired + protected UserDetailsService userDetailsService; + + @Autowired + protected BCryptPasswordEncoder passwordEncoder; + + abstract HttpSecurityConfigurer getHttpSecurityConfigurer(); + + @Override + protected void configure(final HttpSecurity http) throws Exception { + HttpSecurityConfigurer httpSecurityConfigurer = getHttpSecurityConfigurer(); + LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass()); + + httpSecurityConfigurer.configure(http); + } + + @Override + public void configure(final WebSecurity web) throws Exception { + super.configure(web); + final StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + + @Override + protected void configure(final AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); + } +} diff --git a/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java new file mode 100644 index 0000000000..27c998f87d --- /dev/null +++ b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java @@ -0,0 +1,33 @@ +package org.onap.so.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.stereotype.Component; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import java.util.Arrays; + +@Component("cors") +@Profile({"cors"}) +public class CorsBasicHttpSecurityConfigurer implements HttpSecurityConfigurer { + + @Override + public void configure(final HttpSecurity http) throws Exception { + http.cors().and().csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() + .antMatchers("/**").fullyAuthenticated().and().httpBasic(); + } + + @Bean + CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(Arrays.asList("*")); + configuration.setAllowedMethods(Arrays.asList("OPTIONS", "GET", "POST", "PATCH")); + configuration.setAllowCredentials(true); + configuration.setAllowedHeaders(Arrays.asList("*")); + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", configuration); + return source; + } +} diff --git a/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java new file mode 100644 index 0000000000..08ecd0c578 --- /dev/null +++ b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java @@ -0,0 +1,24 @@ +package org.onap.so.security; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.core.annotation.Order; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +@EnableWebSecurity +@Configuration +@Order(1) +@Profile({"cors"}) +public class CorsWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter { + @Autowired + @Qualifier("cors") + protected HttpSecurityConfigurer httpSecurityConfigurer; + + @Override + HttpSecurityConfigurer getHttpSecurityConfigurer() { + return httpSecurityConfigurer; + } +} diff --git a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java index 9aceb03519..da989ee42a 100644 --- a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java +++ b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java @@ -28,7 +28,7 @@ import org.springframework.util.StringUtils; * @author Waqas Ikram (waqas.ikram@est.tech) * */ -@Component +@Component("basic") public class SoBasicHttpSecurityConfigurer implements HttpSecurityConfigurer { @Autowired diff --git a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java index 903d586ab1..c14ae47d89 100644 --- a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java +++ b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java @@ -19,20 +19,12 @@ */ package org.onap.so.security; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.annotation.Order; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.firewall.StrictHttpFirewall; /** * @author Waqas Ikram (waqas.ikram@est.tech) @@ -42,34 +34,13 @@ import org.springframework.security.web.firewall.StrictHttpFirewall; @Configuration @Order(1) @Profile({"basic", "test"}) -public class SoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { - private static final Logger LOGGER = LoggerFactory.getLogger(SoWebSecurityConfigurerAdapter.class); - - @Autowired - private HttpSecurityConfigurer httpSecurityConfigurer; - +public class SoWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter { @Autowired - private UserDetailsService userDetailsService; - - @Autowired - private BCryptPasswordEncoder passwordEncoder; - - @Override - protected void configure(final HttpSecurity http) throws Exception { - LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass()); - - httpSecurityConfigurer.configure(http); - } - - @Override - public void configure(final WebSecurity web) throws Exception { - super.configure(web); - final StrictHttpFirewall firewall = new MSOSpringFirewall(); - web.httpFirewall(firewall); - } + @Qualifier("basic") + protected HttpSecurityConfigurer httpSecurityConfigurer; @Override - protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); + HttpSecurityConfigurer getHttpSecurityConfigurer() { + return httpSecurityConfigurer; } } |