Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 是否可以在';中设置请求授权;serverless.yml';使用无服务器1.0.0-beta.1.1的文件?_Amazon Web Services_Yaml_Aws Api Gateway_Serverless Framework - Fatal编程技术网

Amazon web services 是否可以在';中设置请求授权;serverless.yml';使用无服务器1.0.0-beta.1.1的文件?

Amazon web services 是否可以在';中设置请求授权;serverless.yml';使用无服务器1.0.0-beta.1.1的文件?,amazon-web-services,yaml,aws-api-gateway,serverless-framework,Amazon Web Services,Yaml,Aws Api Gateway,Serverless Framework,我刚刚试用了的.1.0.0-beta.1.1版,看起来很有希望 我希望使用AWS\u IAM对请求进行身份验证 我可以使用AWS网关API控制台,将每个方法请求从none更改为AWS_IAM。用手,我可以使它工作 但是,我宁愿更改无服务器服务中的serverless.yml文件 我尝试添加一个authorizationType字段,如下所示: - http: path: greet method: get authorizationType: AWS_IAM

我刚刚试用了的.1.0.0-beta.1.1版,看起来很有希望

我希望使用
AWS\u IAM
对请求进行身份验证

我可以使用AWS网关API控制台,将每个方法请求从
none
更改为
AWS_IAM
。用手,我可以使它工作

但是,我宁愿更改无服务器服务中的
serverless.yml
文件

我尝试添加一个
authorizationType
字段,如下所示:

- http:
      path: greet
      method: get
      authorizationType: AWS_IAM
但未更新API网关的授权设置,未经授权的请求仍被接受



是否可以将
serverless.yml
文件设置为使用
AWS_IAM

查看以下链接,以获取我在身份验证帮助中找到的最接近的链接:

我没有使用AWS_IAM,但这里是我如何定义自定义身份验证的,它应该指示总体格式

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
          authorizer:
            arn: arn:aws:lambda:us-east-1:xxxxxx:function:jwtAuthorize
            resultTtlInSeconds: 0
            identitySource: method.request.header.Authorization
            identityValidationExpression: JWT [^\.]+\.[^\.]+\.[^\.]+
因此,我认为您需要添加
授权人
部分。我无法对此进行测试,但如果它不能以这种方式工作,请告诉我:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
          authorizer:
            authorizationType: AWS_IAM

签出以下链接以获取我在“身份验证帮助”中找到的最接近的链接:

我没有使用AWS_IAM,但这里是我如何定义自定义身份验证的,它应该指示总体格式

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
          authorizer:
            arn: arn:aws:lambda:us-east-1:xxxxxx:function:jwtAuthorize
            resultTtlInSeconds: 0
            identitySource: method.request.header.Authorization
            identityValidationExpression: JWT [^\.]+\.[^\.]+\.[^\.]+
因此,我认为您需要添加
授权人
部分。我无法对此进行测试,但如果它不能以这种方式工作,请告诉我:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
          authorizer:
            authorizationType: AWS_IAM

在serverless 1.0.0-RC2中,您可以如下设置authorizationType

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get    

resources:
  Resources:
    ApiGatewayMethodHelloGet:
      Properties:
        AuthorizationType: AWS_IAM 

在serverless 1.0.0-RC2中,您可以如下设置authorizationType

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get    

resources:
  Resources:
    ApiGatewayMethodHelloGet:
      Properties:
        AuthorizationType: AWS_IAM 

授权类型:AWS_IAM肯定不起作用。ServerlessError:请提供授权人名称或ARNauthorizationType:AWS_IAM肯定不起作用。ServerLesError:请提供授权人名称或ARN