openwhisk-apigateway icon indicating copy to clipboard operation
openwhisk-apigateway copied to clipboard

Security block has to be repeated on api and tenant scope

Open taylorking opened this issue 8 years ago • 1 comments

the existing api object looks like this when you have security scoped to a tenant

{
  "name":"test",
  "tenantId":"something-something-something",
  "basePath":"/v1"
  "resources": {
    "/test": {
      "operations":{ 
        "GET": {
          "upstreamUrl":"http://test.com/entity",
          "upstreamMethod":"GET",
          "security":{
            "type":"oauth",
            "provider":"google",
            "scope":"api"
          }   
        },  
        "POST": {
          "upstreamUrl":"http://test.com/entity",
          "upstreamMethod":"GET",
          "security":{                                                                                                                                        
            "type":"oauth",
            "provider":"google",
            "scope":"api"
          }   
        }   
      }   
    }   
  }
}

it should look like this:

{
  "name":"test",
  "tenantId":"something-something-something",
  "basePath":"/v1",
  "resources":{
    "/test": {
      "operations":{
        "GET": {
          "upstreamUrl":"http://test.com/entity",
          "upstreamMethod":"GET",
        },  
        "POST": {
          "upstreamUrl":"http://test.com/entity",
          "upstreamMethod":"GET",
        }   
      }   
    }   
  },  
  "security":{
    "type":"oauth",
    "provider":"google"
  }
}

taylorking avatar Jan 20 '17 16:01 taylorking

Additionally,

  {
    "managedUrl": "http://0.0.0.0:8080/api/8e7315c3-bf66-4ec3-9157-c725f1c572d8/v2",
    "tenantId": "8e7315c3-bf66-4ec3-9157-c725f1c572d8",
    "id": "8ecf6f30-709f-49a7-8901-46eed0cfeb45",
    "basePath": "/v2",
    "name": "test",
    "resources": {
      "/die": {
        "operations": {
          "GET": {
            "backendUrl": "https://apim-banka.mybluemix.net/banka/v1/branches",
            "security": {
              "type": "apikey",
              "secret": "true",
              "scope": "resource"
            },
            "backendMethod": "GET"
          }
        }
      }
    }
  }

should probably be

  {
    "managedUrl": "http://0.0.0.0:8080/api/8e7315c3-bf66-4ec3-9157-c725f1c572d8/v2",
    "tenantId": "8e7315c3-bf66-4ec3-9157-c725f1c572d8",
    "id": "8ecf6f30-709f-49a7-8901-46eed0cfeb45",
    "basePath": "/v2",
    "name": "test",
    "resources": {
      "/die": {
        "operations": {
          "GET": {
            "backendUrl": "https://apim-banka.mybluemix.net/banka/v1/branches",
            "backendMethod": "GET"
          }
         },
         "security": {
              "type": "apikey",
              "secret": "true",
          }
       }
    }
  }

taylorking avatar Jan 21 '17 03:01 taylorking