diff options
-rw-r--r-- | src/main/docker/backend/Dockerfile | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/clamp/clds/ClampServlet.java | 20 | ||||
-rw-r--r-- | src/main/resources/application-noaaf.properties | 2 | ||||
-rw-r--r-- | src/main/resources/application.properties | 4 | ||||
-rw-r--r-- | src/test/resources/application.properties | 3 | ||||
-rw-r--r-- | src/test/resources/https/https-test.properties | 2 | ||||
-rw-r--r-- | src/test/resources/robotframework/robotframework-test.properties | 2 |
7 files changed, 16 insertions, 19 deletions
diff --git a/src/main/docker/backend/Dockerfile b/src/main/docker/backend/Dockerfile index ebc1d57f2..8712f1934 100644 --- a/src/main/docker/backend/Dockerfile +++ b/src/main/docker/backend/Dockerfile @@ -42,4 +42,4 @@ COPY --chown=onap:onap onap-clamp-backend/clamp.jar /opt/clamp/app.jar USER onap
WORKDIR /opt/clamp/
-ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-jar" ,"./app.jar"]
\ No newline at end of file +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=75","-jar" ,"./app.jar"]
\ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/ClampServlet.java b/src/main/java/org/onap/clamp/clds/ClampServlet.java index 5908201fd..c19972791 100644 --- a/src/main/java/org/onap/clamp/clds/ClampServlet.java +++ b/src/main/java/org/onap/clamp/clds/ClampServlet.java @@ -28,9 +28,11 @@ package org.onap.clamp.clds; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import fj.data.Array; import java.io.IOException; import java.security.Principal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.servlet.ServletException; @@ -69,16 +71,11 @@ public class ClampServlet extends CamelHttpTransportServlet { private static List<SecureServicePermission> permissionList; - private synchronized Class loadDynamicAuthenticationClass() { - try { - String authenticationObject = WebApplicationContextUtils.getWebApplicationContext(getServletContext()) - .getEnvironment().getProperty(AUTHENTICATION_CLASS); - return Class.forName(authenticationObject); - } catch (ClassNotFoundException e) { - logger.error( - "Exception caught when attempting to create associated class of config:" + AUTHENTICATION_CLASS, e); - return Object.class; - } + private synchronized String[] loadDynamicAuthenticationClasses() { + String[] authenticationObjects = WebApplicationContextUtils.getWebApplicationContext(getServletContext()) + .getEnvironment().getProperty(AUTHENTICATION_CLASS).split(","); + Arrays.stream(authenticationObjects).forEach(className -> className.trim()); + return authenticationObjects; } private synchronized List<SecureServicePermission> getPermissionList() { @@ -115,7 +112,8 @@ public class ClampServlet extends CamelHttpTransportServlet { @Override protected void doService(HttpServletRequest request, HttpServletResponse response) { Principal principal = request.getUserPrincipal(); - if (loadDynamicAuthenticationClass().isInstance(principal)) { + if (principal != null && Arrays.stream(loadDynamicAuthenticationClasses()) + .anyMatch(className -> className.equals(principal.getName()))) { // When AAF is enabled, there is a need to provision the permissions to Spring // system List<GrantedAuthority> grantedAuths = new ArrayList<>(); diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties index 423c73e93..6b28cf7ef 100644 --- a/src/main/resources/application-noaaf.properties +++ b/src/main/resources/application-noaaf.properties @@ -173,7 +173,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal, org.onap.aaf.cadi.principal.CachedBasicPrincipal ## Tosca converter clamp.config.tosca.converter.json.schema.templates=classpath:/clds/tosca-converter/templates.json diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index de32098fa..1b5a26d0a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -176,13 +176,13 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal, org.onap.aaf.cadi.principal.CachedBasicPrincipal #AAF related parameters clamp.config.cadi.cadiLoglevel=DEBUG clamp.config.cadi.cadiLatitude=10 clamp.config.cadi.cadiLongitude=10 -clamp.config.cadi.aafLocateUrl=https://aaf-locate:8095 +clamp.config.cadi.aafLocateUrl=https://aaf-locate:30251 clamp.config.cadi.oauthTokenUrl= https://AAF_LOCATE_URL/locate/onap.org.osaaf.aaf.token:2.1/token clamp.config.cadi.oauthIntrospectUrll=https://AAF_LOCATE_URL/locate/onap.org.osaaf.aaf.introspect:2.1/introspect clamp.config.cadi.aafEnv=DEV diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index a8ec7add1..5a668dcf4 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -160,8 +160,7 @@ clamp.config.security.permission.type.template=permission-type-template clamp.config.security.permission.type.tosca=permission-type-tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal - +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal, org.onap.aaf.cadi.principal.CachedBasicPrincipal # Configuration settings for CDS clamp.config.cds.url=http4://localhost:${docker.http-cache.port.host} clamp.config.cds.userName=ccsdkapps diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties index 6f3a405fc..86e444efe 100644 --- a/src/test/resources/https/https-test.properties +++ b/src/test/resources/https/https-test.properties @@ -116,7 +116,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal, org.onap.aaf.cadi.principal.CachedBasicPrincipal #AAF related parameters clamp.config.cadi.cadiLoglevel=DEBUG diff --git a/src/test/resources/robotframework/robotframework-test.properties b/src/test/resources/robotframework/robotframework-test.properties index 4ec657355..665842b84 100644 --- a/src/test/resources/robotframework/robotframework-test.properties +++ b/src/test/resources/robotframework/robotframework-test.properties @@ -160,7 +160,7 @@ clamp.config.security.permission.type.template=permission-type-template clamp.config.security.permission.type.tosca=permission-type-tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev -clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal, org.onap.aaf.cadi.principal.CachedBasicPrincipal # Configuration settings for CDS clamp.config.cds.url=http4://localhost:${docker.http-cache.port.host} |