【问题标题】:Add authorizer to api gateway in SAM json在 SAM json 中将授权方添加到 api 网关
【发布时间】:2021-04-10 09:16:23
【问题描述】:

我有这个 SAM:

"ApiGatewayApi":
  {
    "Type": "AWS::Serverless::Api",
    "Properties": {
      "StageName": "Prod",
      "Name" : "MainGateway",
      "Cors": {
        "AllowMethods": "'POST, GET, PUT, DELETE'",
        "AllowHeaders": "'access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,authorization,content-type'",
        "AllowOrigin": "'*'",
        "MaxAge": "'1'"
      }
    }
  },

我尝试像这样添加授权人:

"RESTAuthorizerGeneral":
  {
  "Type" : "AWS::ApiGateway::Authorizer",
  "Properties" : {
  "Name" : "HTTPAuthorizer",
  "Type" : "TOKEN",
  "IdentitySource" : "method.request.header.Authorization",
  "RestApiId" : {"Ref": "ApiGatewayApi"},
  "AuthorizerUri" : ""
    }
  },

1 - 我收到此错误:ApiGatewayApi 是此引用的无效类型。

2 - 如何填写“AuthorizerUri”字段?

【问题讨论】:

    标签: aws-lambda amazon-cloudformation aws-api-gateway aws-serverless


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2018-05-27
      • 1970-01-01
      • 1970-01-01
      • 2021-01-09
      • 1970-01-01
      • 2016-11-25
      • 2019-05-14
      • 2018-01-24
      • 2020-06-22
      相关资源
      最近更新 更多