Amazon web services 是否可以在';中设置请求授权;serverless.yml';使用无服务器1.0.0-beta.1.1的文件?
我刚刚试用了的.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
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