aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-10-23 14:32:24 +0200
committersebdet <sebastien.determe@intl.att.com>2020-10-23 14:32:24 +0200
commit011b25b15daebaf1e46d2b0d94c522f2dc9c67f5 (patch)
tree51762d85997045b3353f72c74f378a2a7df73c8d
parent66e68b859d8faa62ca854741f9b8bc579571c9b9 (diff)
Fix the AAF login5.1.4
Current code does not check the right Principal class name Issue-ID: CLAMP-956 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I779d6c15ae7fc0240becf106ed40cd3c0b80f22e
-rw-r--r--src/main/java/org/onap/clamp/clds/ClampServlet.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/onap/clamp/clds/ClampServlet.java b/src/main/java/org/onap/clamp/clds/ClampServlet.java
index 6adb76cb..8ebc7a16 100644
--- a/src/main/java/org/onap/clamp/clds/ClampServlet.java
+++ b/src/main/java/org/onap/clamp/clds/ClampServlet.java
@@ -35,6 +35,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -71,11 +73,10 @@ public class ClampServlet extends CamelHttpTransportServlet {
private static List<SecureServicePermission> permissionList;
- 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<String> loadDynamicAuthenticationClasses() {
+ return Arrays.stream(WebApplicationContextUtils.getWebApplicationContext(getServletContext())
+ .getEnvironment().getProperty(AUTHENTICATION_CLASS).split(",")).map(className -> className.trim())
+ .collect(Collectors.toList());
}
private synchronized List<SecureServicePermission> getPermissionList() {
@@ -112,7 +113,7 @@ public class ClampServlet extends CamelHttpTransportServlet {
@Override
protected void doService(HttpServletRequest request, HttpServletResponse response) {
Principal principal = request.getUserPrincipal();
- if (principal != null && Arrays.stream(loadDynamicAuthenticationClasses())
+ if (principal != null && loadDynamicAuthenticationClasses().stream()
.anyMatch(className -> className.equals(principal.getClass().getName()))) {
// When AAF is enabled, there is a need to provision the permissions to Spring
// system