knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pzamp...@apache.org
Subject [4/4] knox git commit: KNOX-1387 - NPE in AclsAuthorizationFilter
Date Thu, 19 Jul 2018 19:14:06 GMT
KNOX-1387 - NPE in AclsAuthorizationFilter


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/52985486
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/52985486
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/52985486

Branch: refs/heads/master
Commit: 529854861c9882f6124ab1a84909f5aa1a813676
Parents: c3851dd
Author: Phil Zampino <pzampino@apache.org>
Authored: Fri Jul 13 08:10:29 2018 -0400
Committer: Phil Zampino <pzampino@apache.org>
Committed: Thu Jul 19 15:13:19 2018 -0400

----------------------------------------------------------------------
 .../org/apache/knox/gateway/filter/AclParser.java   | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/52985486/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
index ceac18e..9df4059 100644
--- a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
+++ b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
@@ -24,11 +24,11 @@ import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.util.IpAddressValidator;
 
 /**
+ *
  */
 public class AclParser {
   private static AclsAuthorizationMessages log = MessagesFactory.get( AclsAuthorizationMessages.class
);
 
-  public String resourceRole;
   public ArrayList<String> users;
   public ArrayList<String> groups;
   public boolean anyUser = true;
@@ -37,6 +37,9 @@ public class AclParser {
 
 
   public AclParser() {
+    users = new ArrayList<>();
+    groups = new ArrayList<>();
+    ipv = new IpAddressValidator(null);
   }
   
   public void parseAcls(String resourceRole, String acls) throws InvalidACLException {
@@ -45,8 +48,7 @@ public class AclParser {
       if (parts.length != 3) {
         log.invalidAclsFoundForResource(resourceRole);
         throw new InvalidACLException("Invalid ACLs specified for requested resource: " +
resourceRole);
-      }
-      else {
+      } else {
         log.aclsFoundForResource(resourceRole);
       }
       parseUserAcls(parts);
@@ -54,17 +56,12 @@ public class AclParser {
       parseGroupAcls(parts);
 
       parseIpAddressAcls(parts);
-    }
-    else {
+    } else {
       log.noAclsFoundForResource(resourceRole);
-      users = new ArrayList<String>();
-      groups = new ArrayList<String>();
-      ipv = new IpAddressValidator(null);
     }
   }
 
   private void parseUserAcls(String[] parts) {
-    users = new ArrayList<String>();
     Collections.addAll(users, parts[0].split(","));
     if (!users.contains("*")) {
       anyUser = false;
@@ -72,7 +69,6 @@ public class AclParser {
   }
 
   private void parseGroupAcls(String[] parts) {
-    groups = new ArrayList<String>();
     Collections.addAll(groups, parts[1].split(","));
     if (!groups.contains("*")) {
       anyGroup = false;


Mime
View raw message