mdeuser 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_r172235982
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
 ##########
 @@ -483,7 +483,24 @@ 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)) {
+                    val requireWebAuthIsBool = 
(action.annotations.getAs[Boolean]("require-whisk-auth") != None)
+                    val annotationRequireWebAuthIsIntOrString = 
((action.annotations
+                      .getAs[String]("require-whisk-auth") != None) || 
(action.annotations
+                      .getAs[Int]("require-whisk-auth") != None))
+                    val annotationRequireWebAuth = (action.annotations
+                      .getAs[Int]("require-whisk-auth")
+                      
.getOrElse(action.annotations.getAs[String]("require-whisk-auth").getOrElse("")))
+                      .toString
+                    val enforceWhiskAuthHdr = (!requireWebAuthIsBool && 
annotationRequireWebAuthIsIntOrString)
+                    val headerWhiskAuthSeq = 
context.headers.filter(_.lowercaseName == "x-require-whisk-auth")
 
 Review comment:
   yes, that works much better.  thanks!

----------------------------------------------------------------
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