rabbah commented on a change in pull request #3388: Update require-whisk-auth 
behavior to secure web action
URL: 
https://github.com/apache/incubator-openwhisk/pull/3388#discussion_r172498687
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##########
 @@ -483,7 +483,29 @@ trait WhiskWebActionsApi extends Directives with 
ValidateRequestSize with PostAc
               provide(fullyQualifiedActionName(actionName)) { fullActionName =>
                 onComplete(verifyWebAction(fullActionName, 
onBehalfOf.isDefined)) {
                   case Success((actionOwnerIdentity, action)) =>
-                    if 
(!action.annotations.getAs[Boolean]("web-custom-options").exists(identity)) {
+                    // If the require-whisk-auth annotation is either an 
integer or a string, secure the web action by enforcing
+                    //   require-whisk-auth annotation value == request header 
x-require-whisk-auth value
+                    // If the require-whisk-auth annotation is a boolean, skip 
the request header x-require-whisk-auth check
+                    val requireWhiskHeaderAuthenticationFailed = 
action.annotations
+                      .get(WhiskAction.requireWhiskAuthAnnotation)
+                      .flatMap {
+                        case JsString(authStr) => Some(authStr)
+                        case JsNumber(authNum) => Some(authNum.toInt.toString)
 
 Review comment:
   do you need .toInt?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to