diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java | 18 | ||||
-rw-r--r-- | src/test/javascript/package.json | 46 |
2 files changed, 12 insertions, 52 deletions
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java index 7e104c74b..cd141ae77 100644 --- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java +++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java @@ -144,16 +144,22 @@ public class ClampCadiFilter extends CadiFilter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { - String certHeader = URLDecoder.decode(((HttpServletRequest) request).getHeader("X-SSL-Cert"), - StandardCharsets.UTF_8.toString()); + String certHeader = ((HttpServletRequest) request).getHeader("X-SSL-Cert"); if (certHeader != null) { - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) certificateFactory - .generateCertificate(new ByteArrayInputStream(certHeader.getBytes())); - request.setAttribute("javax.servlet.request.X509Certificate", cert); - + .generateCertificate(new ByteArrayInputStream( + URLDecoder.decode(certHeader, StandardCharsets.UTF_8.toString()).getBytes())); + X509Certificate[] certifArray = ((X509Certificate[]) request + .getAttribute("javax.servlet.request.X509Certificate")); + if (certifArray == null) { + certifArray = new X509Certificate[] { cert }; + request.setAttribute("javax.servlet.request.X509Certificate", certifArray); + } else { + certifArray[0] = cert; + } } + } catch (CertificateException e) { logger.error("Unable to inject the X.509 certificate", e); } diff --git a/src/test/javascript/package.json b/src/test/javascript/package.json deleted file mode 100644 index a2f0cd2eb..000000000 --- a/src/test/javascript/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "scripts": { - "test": "jest", - "test:watch": "jest --watch", - "test:coverage": "jest --coverage" - }, - "jest": { - "verbose": true, - "coverageDirectory": "${project.build.directory}/clamp-ui/coverage", - "collectCoverageFrom": [ - "**/designer/**/*.{js,jsx}", - "!**/designer/lib/**" - ], - "rootDir": "${project.build.directory}/clamp-ui", - "roots": [ - "${project.basedir}/src/test/javascript/", - "<rootDir>/designer/" - ], - "moduleDirectories": [ - "${project.build.directory}/clamp-ui/node/node_modules", - "${project.build.directory}/clamp-ui/node_modules", - "<rootDir>/designer" - ], - "coverageReporters": [ - "lcov" - ] - }, - "devDependencies": { - "angular": "1.3.2", - "angular-resource": "1.3.2", - "angular-cookies": "1.3.2", - "angular-route": "1.3.2", - "angular-mocks": "1.3.2", - "angular-animate": "1.3.2", - "angular-sanitize": "1.3.2", - "angular-touch": "1.3.2", - "angular-dialog-service": "5.3.0", - "angular-loading-bar": "0.9.0", - "jquery": "3.3.1", - "popper.js": "1.14.4", - "bootstrap": "4.1.1", - "angular-ui-bootstrap": "2.5.6", - "jest": "^23.6.0", - "jest-cli": "^21.2.1" - } -} |