You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2022/12/18 12:03:18 UTC

[GitHub] [knox] moresandeep commented on a diff in pull request #681: KNOX-2839 - Identity assertion provider handles Hadoop ProxyUser auth using the 'doAs' query parameter

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


##########
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:
   Looks like the guava dependency is used for testing, if so perhaps just changing the scope to testing might work?



##########
gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthFilter.java:
##########
@@ -200,12 +202,12 @@ protected void doFilter(FilterChain filterChain, HttpServletRequest request, Htt
     HttpServletRequest proxyRequest = null;
     final String remoteUser = request.getRemoteUser();
     if (!ignoreDoAs(remoteUser)) {
-      final String doAsUser = request.getParameter(QUERY_PARAMETER_DOAS);
+      final String doAsUser = request.getParameter(AuthFilterUtils.QUERY_PARAMETER_DOAS);
       if (doAsUser != null && !doAsUser.equals(remoteUser)) {
         LOG.hadoopAuthDoAsUser(doAsUser, remoteUser, request.getRemoteAddr());
         if (request.getUserPrincipal() != null) {
           try {
-            proxyRequest = AuthFilterUtils.getProxyRequest(request, doAsUser, topologyName, HadoopAuthDeploymentContributor.NAME);
+            proxyRequest = AuthFilterUtils.getProxyRequest(request, request.getUserPrincipal().getName(), doAsUser, topologyName, HadoopAuthDeploymentContributor.NAME);

Review Comment:
   nit: we are passing the request object, so request.getUserPrincipal().getName() can be deduced from it, additional param seems redundant.



-- 
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: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org