You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "soumitra-st (via GitHub)" <gi...@apache.org> on 2023/09/12 16:23:48 UTC

[GitHub] [pinot] soumitra-st commented on a diff in pull request #11501: Change the Forbidden error to Unauthorized

soumitra-st commented on code in PR #11501:
URL: https://github.com/apache/pinot/pull/11501#discussion_r1323288750


##########
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java:
##########
@@ -158,7 +158,7 @@ public Map<ServerInstance, List<String>> getRoutingTableForQuery(
       if (!_accessControlFactory.create()
           .hasAccess(httpHeaders, TargetType.TABLE, brokerRequest.getQuerySource().getTableName(),
               Actions.Table.GET_ROUTING_TABLE)) {
-        throw new WebApplicationException("Permission denied", Response.Status.FORBIDDEN);
+        throw new WebApplicationException("Unauthorized", Response.Status.UNAUTHORIZED);

Review Comment:
   Let's keep 403 here, and handle the authN issues in the access control object, such as for BasicAuthAccessControl, the change should be done [HERE](https://github.com/apache/pinot/blob/70c4c5b8019b3c3b71865bde71e4899c3659082e/pinot-broker/src/main/java/org/apache/pinot/broker/broker/BasicAuthAccessControlFactory.java#L90) .
   Instead of
         if (!principalOpt.isPresent()) {
           // no matching token? reject
           return false;
         }
   
   try:
   
         if (!principalOpt.isPresent()) {
           // no matching token? reject
          throw new WebApplicationException("No token", Response.Status.UNAUTHORIZED);
         }



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org