You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/03/26 00:51:36 UTC

[GitHub] [incubator-openwhisk-wskdeploy] AnthonyAmanse opened a new issue #1046: Creating an API (API Gateway) with require-whisk-auth does not generate the correct swagger file

AnthonyAmanse opened a new issue #1046: Creating an API (API Gateway) with require-whisk-auth does not generate the correct swagger file
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/1046
 
 
   Using `wskdeploy` to create APIs with action, by default, publicly exposes the action's web api (example: `https://us-south.functions.cloud.ibm.com/api/v1/web/<redacted>/hello/world.json`).
   
   When using `require-whisk-auth` to secure the action, `wskdeploy` successfully creates the API but the swagger file is missing a necessary block to add the `X-Require-Whisk-Auth` header.
   
   manifest.yaml file used:
   ```yaml
   ---
   packages:
     test-package:
       actions:
         hello-action:
           function: test.js
           runtime: nodejs:10
           web: true
           annotations:
             require-whisk-auth: 123-456
       apis:
         test-api:
           hello:
             world:
               hello-action:
                 method: GET
                 response: json
   ```
   
   Swagger file from API:
   ```yaml
   wsk api get test-api --format yaml
   ...
   x-ibm-configuration:
     assembly:
       execute:
       - operation-switch:
           case:
           - execute:
             - invoke:
                 target-url: https://us-south.functions.cloud.ibm.com/api/v1/web/<redacted>/test-package/hello-action.json
                 verb: keep
             operations:
             - getWorld
     cors:
       enabled: true
   ...
   ```
   
   Result for calling the API:
   ```
   curl https://<redacted>/hello/world
   {
     "code": "e9d00b616b4447d3703db4d45986edf9",
     "error": "Authentication is possible but has failed or not yet been provided."
   }
   ```
   
   
   Expected swagger file: (using `wsk` cli or the IBM Cloud UI has the correct swagger)
   ```yaml
   wsk package create test-package
   wsk action create test-package/hello-action test.js --web true --web-secure 123-456
   wsk api create /hello /world get test-package/hello-action -n test-api
   
   ...
   x-ibm-configuration:
     assembly:
       execute:
       - operation-switch:
           case:
           - execute:
             - invoke:
                 target-url: https://us-south.functions.cloud.ibm.com/api/v1/web/<redacted>/test-package/hello-action.json
                 verb: keep
             - set-variable:
                 actions:
                 - set: message.headers.X-Require-Whisk-Auth
                   value: 123-456
             operations:
             - getWorld
     cors:
       enabled: true
   ...
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services