You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "g3rg0 (via GitHub)" <gi...@apache.org> on 2023/10/03 10:36:38 UTC

Re: [PR] HIVE-27661: Auth mode inferred from the Authorization header [hive]

g3rg0 commented on code in PR #4666:
URL: https://github.com/apache/hive/pull/4666#discussion_r1343888369


##########
service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java:
##########
@@ -284,7 +283,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
       }
       // Send a 401 to the client
       response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-      if(isAuthTypeEnabled(request, HiveAuthConstants.AuthTypes.KERBEROS)) {
+      if(authType.isEnabled(HiveAuthConstants.AuthTypes.KERBEROS)) {

Review Comment:
   @dengzhhu653 
   It seems that this change is necessary, because the Knox gateway first calls hs2 without _Authorization_ header, then if there is a _WWW-Authenticate: Negotiate_ header in the response, it will only initiate a normal authentication with _Authorization_ header ([so it implements reactive authentication](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-authenticator/#reactive-authentication)):
   https://github.com/apache/knox/blob/master/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/auth/SpnegoAuthInterceptor.java#L105-L113 
   The current code now doesn't work well behind Knox gw when the request is not coming directly from the jdbc driver, so I'll create a bug ticket for this problem and submit the fix. 



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org