rabbah commented on a change in pull request #2877: Better error controller 
message for authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#discussion_r146131568
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
 ##########
 @@ -193,7 +199,14 @@ protected[core] abstract class 
EntitlementProvider(config: WhiskConfig, loadBala
         logging.error(this, s"failed while checking entitlement: 
${t.getMessage}")
     } flatMap { isAuthorized =>
       if (isAuthorized) Future.successful({})
-      else Future.failed(RejectRequest(Forbidden))
+      else
+        Future.failed(
+          RejectRequest(
+            Forbidden,
+            Some(
+              ErrorResponse(
+                Messages.notAuthorizedtoAccessResource(resources.map(r => 
r.fqname).mkString(", ")),
+                transid))))
 
 Review comment:
   I don't think this is particularly helpful in the context of this PR/fixing 
the related issue - the priv check is over a set of resources, and 
`isAuthorized` is a predicate that must hold over all of them. At this point, 
you can't disambiguate which of the resources was the one that failed the 
check. So the message is a blanket failure accessing all resources instead of 
the possibly just one that failed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to