aboutsummaryrefslogtreecommitdiffstats
path: root/sidecar
diff options
context:
space:
mode:
Diffstat (limited to 'sidecar')
-rw-r--r--sidecar/fproxy/pom.xml6
-rw-r--r--sidecar/pom.xml19
-rw-r--r--sidecar/rproxy/config/cadi.properties5
-rw-r--r--sidecar/rproxy/pom.xml4
-rw-r--r--sidecar/rproxy/src/main/java/org/onap/aaf/cadi/sidecar/rproxy/mocks/ReverseProxyMockCadiFilter.java194
5 files changed, 149 insertions, 79 deletions
diff --git a/sidecar/fproxy/pom.xml b/sidecar/fproxy/pom.xml
index eb6223c..2608254 100644
--- a/sidecar/fproxy/pom.xml
+++ b/sidecar/fproxy/pom.xml
@@ -65,6 +65,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
diff --git a/sidecar/pom.xml b/sidecar/pom.xml
index 2558b55..424f29c 100644
--- a/sidecar/pom.xml
+++ b/sidecar/pom.xml
@@ -33,7 +33,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <sonar.skip>true</sonar.skip>
+ <sonar.skip>false</sonar.skip>
<jacoco.version>0.7.7.201606060606</jacoco.version>
<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
@@ -53,8 +53,9 @@
<!-- Spring boot version
Must match oParent
-->
- <spring.boot.version>2.0.3.RELEASE</spring.boot.version>
+ <spring.boot.version>2.0.5.RELEASE</spring.boot.version>
<spring.web.version>3.0.4.RELEASE</spring.web.version>
+
<docker.location>${basedir}/target</docker.location>
<!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> -->
@@ -119,7 +120,7 @@
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
</dependency>
-
+
</dependencies>
</dependencyManagement>
@@ -135,6 +136,18 @@
<build>
<pluginManagement>
<plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <!-- Suppresses parent pom config of Surefire plugin. Has the affect of
+ setting Surefire file includes back to default and re-enables sidecar
+ unit tests -->
+ <includes combine.self="override"></includes>
+ </configuration>
+ </plugin>
+
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
diff --git a/sidecar/rproxy/config/cadi.properties b/sidecar/rproxy/config/cadi.properties
index 543bc1e..cc975e9 100644
--- a/sidecar/rproxy/config/cadi.properties
+++ b/sidecar/rproxy/config/cadi.properties
@@ -16,4 +16,7 @@ aaf_id=demo@people.osaaf.org
aaf_password=enc:92w4px0y_rrm265LXLpw58QnNPgDXykyA1YTrflbAKz
# This is a colon separated list of client cert issuers
-cadi_x509_issuers=CN=ONAP, OU=ONAP, O=ONAP, L=Ottawa, ST=Ontario, C=CA \ No newline at end of file
+cadi_x509_issuers=CN=ONAP, OU=ONAP, O=ONAP, L=Ottawa, ST=Ontario, C=CA
+
+cadi_latitude=80.62
+cadi_longitude=72.62
diff --git a/sidecar/rproxy/pom.xml b/sidecar/rproxy/pom.xml
index e8b03be..ffa6a5a 100644
--- a/sidecar/rproxy/pom.xml
+++ b/sidecar/rproxy/pom.xml
@@ -40,7 +40,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
- <!--
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
@@ -50,9 +49,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</exclusion>
-
</exclusions>
- -->
</dependency>
<dependency>
@@ -68,6 +65,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
diff --git a/sidecar/rproxy/src/main/java/org/onap/aaf/cadi/sidecar/rproxy/mocks/ReverseProxyMockCadiFilter.java b/sidecar/rproxy/src/main/java/org/onap/aaf/cadi/sidecar/rproxy/mocks/ReverseProxyMockCadiFilter.java
index 1c4de92..6c9665f 100644
--- a/sidecar/rproxy/src/main/java/org/onap/aaf/cadi/sidecar/rproxy/mocks/ReverseProxyMockCadiFilter.java
+++ b/sidecar/rproxy/src/main/java/org/onap/aaf/cadi/sidecar/rproxy/mocks/ReverseProxyMockCadiFilter.java
@@ -19,9 +19,6 @@
*/
package org.onap.aaf.cadi.sidecar.rproxy.mocks;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
import java.io.IOException;
import java.security.Principal;
import java.util.List;
@@ -32,6 +29,8 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
+
+import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.CadiWrap;
import org.onap.aaf.cadi.Lur;
import org.onap.aaf.cadi.Permission;
@@ -41,13 +40,13 @@ import org.onap.aaf.cadi.taf.TafResp;
public class ReverseProxyMockCadiFilter implements Filter {
- private FakeLur fakeLur = new FakeLur();
+ private FakeLur fakeLur = new FakeLur();
- static class FakeLur implements Lur {
+ static class FakeLur implements Lur {
@Override
public void fishAll(Principal bait, List<Permission> permissions) {
-
+
final String WildcardPermissionType = "test.wildcard.access";
final String MultiplePermissionType = "test.multiple.access";
final String TestAuthAccessPermissionType = "test.auth.access";
@@ -57,16 +56,11 @@ public class ReverseProxyMockCadiFilter implements Filter {
if (principalName != null && principalName.equals("UserWithInstanceActionWildcardPermissionGranted")) {
permissions.add(new AAFPermission(null, WildcardPermissionType, "*", "*"));
- }
- else
- if (principalName != null && principalName.equals("UserWithInstanceWildcardPermissionGranted")) {
+ } else if (principalName != null && principalName.equals("UserWithInstanceWildcardPermissionGranted")) {
permissions.add(new AAFPermission(null, WildcardPermissionType, "*", PermissionAction));
- }
- else
- if (principalName != null && principalName.equals("UserWithActionWildcardPermissionGranted")) {
- permissions.add(new AAFPermission(null, WildcardPermissionType, "first", "*"));
- }
- else {
+ } else if (principalName != null && principalName.equals("UserWithActionWildcardPermissionGranted")) {
+ permissions.add(new AAFPermission(null, WildcardPermissionType, "first", "*"));
+ } else {
// For single permission test
permissions.add(new AAFPermission(null, "test.single.access", "single", PermissionAction));
@@ -82,62 +76,118 @@ public class ReverseProxyMockCadiFilter implements Filter {
}
}
- @Override
- public Permission createPerm(String p) {
- return null;
- }
-
- @Override
- public boolean fish(Principal bait, Permission... pond) {
- return false;
- }
-
- @Override
- public void destroy() {
- // Mock implementation
- }
-
- @Override
- public boolean handlesExclusively(Permission... pond) {
- return false;
- }
-
- @Override
- public boolean handles(Principal principal) {
- return false;
- }
-
- @Override
- public void clear(Principal p, StringBuilder report) {
- // Mock implementation
- }
-
- }
-
- @Override
- public void destroy() {
- // Mock implementation
- }
-
- @Override
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
- throws IOException, ServletException {
-
- String userName = ((HttpServletRequest)servletRequest).getHeader("PermissionsUser");
-
- TaggedPrincipal mockTaggedPrincipal = mock(TaggedPrincipal.class);
- when(mockTaggedPrincipal.getName()).thenReturn(userName);
-
- TafResp tafResponseMock = mock(TafResp.class);
- when(tafResponseMock.getPrincipal()).thenReturn(mockTaggedPrincipal);
-
- CadiWrap cadiWrap = new CadiWrap((HttpServletRequest) servletRequest, tafResponseMock, fakeLur);
- filterChain.doFilter(cadiWrap, servletResponse);
- }
-
- @Override
- public void init(FilterConfig arg0) throws ServletException {
- // Mock implementation
- }
+ @Override
+ public Permission createPerm(String p) {
+ return null;
+ }
+
+ @Override
+ public boolean fish(Principal bait, Permission... pond) {
+ return false;
+ }
+
+ @Override
+ public void destroy() {
+ // Mock implementation
+ }
+
+ @Override
+ public boolean handlesExclusively(Permission... pond) {
+ return false;
+ }
+
+ @Override
+ public boolean handles(Principal principal) {
+ return false;
+ }
+
+ @Override
+ public void clear(Principal p, StringBuilder report) {
+ // Mock implementation
+ }
+
+ }
+
+ @Override
+ public void destroy() {
+ // Mock implementation
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+ throws IOException, ServletException {
+
+ TafResp tafResponseMock = new TafResp() {
+
+ @Override
+ public void timing(long arg0) {
+ // Mock implementation
+ }
+
+ @Override
+ public float timing() {
+ return 0;
+ }
+
+ @Override
+ public String taf() {
+ return null;
+ }
+
+ @Override
+ public boolean isValid() {
+ return false;
+ }
+
+ @Override
+ public boolean isFailedAttempt() {
+ return false;
+ }
+
+ @Override
+ public RESP isAuthenticated() {
+ return null;
+ }
+
+ @Override
+ public TaggedPrincipal getPrincipal() {
+ return new TaggedPrincipal() {
+
+ @Override
+ public String getName() {
+ return ((HttpServletRequest) servletRequest).getHeader("PermissionsUser");
+ }
+
+ @Override
+ public String tag() {
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public Access getAccess() {
+ return null;
+ }
+
+ @Override
+ public String desc() {
+ return null;
+ }
+
+ @Override
+ public RESP authenticate() throws IOException {
+ return null;
+ }
+ };
+
+ CadiWrap cadiWrap = new CadiWrap((HttpServletRequest) servletRequest, tafResponseMock, fakeLur);
+ filterChain.doFilter(cadiWrap, servletResponse);
+ }
+
+ @Override
+ public void init(FilterConfig arg0) throws ServletException {
+ // Mock implementation
+ }
}