<properties>
<start-class>org.onap.ccsdk.apps.ms.sliboot.SlibootApp</start-class>
- <shiro.version>1.5.0</shiro.version>
- <aaf-shiro-bundle.version>2.1.13</aaf-shiro-bundle.version>
+ <aaf.cadi.version>2.1.21</aaf.cadi.version>
<base.image.name>onap/ccsdk-alpine-j11-image</base.image.name>
<base.image.version>1.1.1</base.image.version>
<image.name>onap/ccsdk-sliboot-alpine-image</image.name>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-spring-boot-web-starter</artifactId>
- <version>${shiro.version}</version>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.aaf.cadi</groupId>
- <artifactId>aaf-cadi-shiro</artifactId>
- <version>${aaf-shiro-bundle.version}</version>
- </dependency>
-
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-cadi-client</artifactId>
+ <version>${aaf.cadi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-cadi-core</artifactId>
+ <version>${aaf.cadi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-auth-client</artifactId>
+ <version>${aaf.cadi.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-misc-env</artifactId>
+ <version>${aaf.cadi.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-misc-rosetta</artifactId>
+ <version>${aaf.cadi.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>services</artifactId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
- <forkMode>always</forkMode>
<environmentVariables>
<SDNC_CONFIG_DIR>${basedir}/src/test/resources</SDNC_CONFIG_DIR>
<SVCLOGIC_PROPERTIES>${basedir}/src/test/resources/svclogic.properties</SVCLOGIC_PROPERTIES>
import org.springframework.boot.SpringApplication;\r
import org.springframework.boot.autoconfigure.SpringBootApplication;\r
import org.springframework.boot.autoconfigure.domain.EntityScan;\r
+import org.springframework.boot.web.servlet.FilterRegistrationBean;\r
import org.springframework.context.annotation.ComponentScan;\r
+import org.springframework.core.annotation.Order;\r
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;\r
import org.springframework.transaction.annotation.EnableTransactionManagement;\r
\r
import springfox.documentation.swagger2.annotations.EnableSwagger2;\r
-import org.apache.shiro.realm.Realm;\r
-import org.apache.shiro.realm.text.PropertiesRealm;\r
-import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;\r
-import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;\r
import org.springframework.context.annotation.Bean;\r
-import org.onap.aaf.cadi.shiro.AAFRealm;\r
+\r
+import org.onap.aaf.cadi.filter.CadiFilter;\r
\r
@SpringBootApplication(scanBasePackages={ "org.onap.ccsdk.apps.ms.sliboot.*", "org.onap.ccsdk.apps.services" })\r
@EnableJpaRepositories("org.onap.ccsdk.apps.ms.sliboot.*")\r
}\r
\r
@Bean\r
- public Realm realm() {\r
-\r
- // If cadi prop files is not defined use local properties realm\r
- // src/main/resources/shiro-users.properties\r
- if ("none".equals(System.getProperty("cadi_prop_files", "none"))) {\r
- log.info("cadi_prop_files undefined, AAF Realm will not be set");\r
- PropertiesRealm realm = new PropertiesRealm();\r
- return realm;\r
- } else {\r
- AAFRealm realm = new AAFRealm();\r
- return realm;\r
- }\r
+ @Order(1)\r
+ public FilterRegistrationBean<CadiFilter> cadiFilter() {\r
+ CadiFilter filter = new CadiFilter();\r
\r
- }\r
+ FilterRegistrationBean<CadiFilter> registrationBean = new FilterRegistrationBean<>();\r
+ registrationBean.setFilter(filter);\r
+ if ("none".equals(System.getProperty("cadi_prop_files", "none"))) {\r
+ log.info("cadi_prop_files undefined, AAF CADI disabled");\r
+ registrationBean.addUrlPatterns("/xxxx/*");\r
+ } else {\r
+ registrationBean.addUrlPatterns("/*");\r
+ registrationBean.addInitParameter("cadi_prop_files", System.getProperty("cadi_prop_files"));\r
+ }\r
\r
- @Bean\r
- public ShiroFilterChainDefinition shiroFilterChainDefinition() {\r
- DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();\r
-\r
- // if cadi prop files is not set disable authentication\r
- if ("none".equals(System.getProperty("cadi_prop_files", "none"))) {\r
- chainDefinition.addPathDefinition("/**", "anon");\r
- } else {\r
- log.info("Loaded property cadi_prop_files, AAF REALM set");\r
- chainDefinition.addPathDefinition("/**", "authcBasic, rest[org.onap.sdnc.odl:odl-api]");\r
- }\r
-\r
- return chainDefinition;\r
- }\r
+ return registrationBean;\r
+ } \r
\r
}\r
+++ /dev/null
-package org.onap.ccsdk.apps.ms.sliboot;
-
-import org.apache.shiro.realm.Realm;
-import org.apache.shiro.realm.text.PropertiesRealm;
-import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-public class AppTest {
-
- SlibootApp app;
-
- @Before
- public void setUp() throws Exception {
- app = new SlibootApp();
- System.setProperty("serviceLogicProperties", "src/test/resources/svclogic.properties");
- }
-
- @Test
- public void realm() {
- Realm realm = app.realm();
- assertTrue(realm instanceof PropertiesRealm);
-
-
- }
-
- @Test
- public void shiroFilterChainDefinition() {
- ShiroFilterChainDefinition chainDefinition = app.shiroFilterChainDefinition();
- Map<String, String> chainMap = chainDefinition.getFilterChainMap();
- assertEquals("anon", chainMap.get("/**"));
-
-
- }
-}
\ No newline at end of file