pzampino commented on code in PR #681:
URL: https://github.com/apache/knox/pull/681#discussion_r1051151340


##########
gateway-provider-identity-assertion-common/pom.xml:
##########
@@ -97,7 +97,14 @@
             <groupId>org.jboss.shrinkwrap</groupId>
             <artifactId>shrinkwrap-api</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>

Review Comment:
   This is needed by hadoop-common?



##########
gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java:
##########
@@ -128,19 +124,19 @@ protected boolean 
enforceAclAuthorizationPolicy(ServletRequest request,
     boolean groupAccess = false;
     boolean ipAddrAccess;
 
-    Subject subject = Subject.getSubject(AccessController.getContext());
-    Principal primaryPrincipal = 
(Principal)subject.getPrincipals(PrimaryPrincipal.class).toArray()[0];
-    log.primaryPrincipal(primaryPrincipal.getName());
-    Object[] impersonations = 
subject.getPrincipals(ImpersonatedPrincipal.class).toArray();
-    if (impersonations.length > 0) {
-      log.impersonatedPrincipal(((Principal)impersonations[0]).getName());
-      userAccess = checkUserAcls((Principal)impersonations[0]);
+    final Subject subject = SubjectUtils.getCurrentSubject();

Review Comment:
   Could this be simplified to
   `
   effectivePrincipalName = SubjectUtils.getCurrentEffectivePrincipalName();
   log.effectivePrincipal(effectivePrincipalName);
   userAccess = checkUserAcls(effectivePrincipalName);
   `



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to