x-amazon-apigateway-authtype 財產 - Amazon API 网关

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

x-amazon-apigateway-authtype 財產

對於 RESTAPIs,此擴充功能可用於定義 Lambda 授權者的自訂類型。在這種情況下,值為任意格式。例如,一個API可能有多個使用不同內部配置的 Lambda 授權者。您可以使用此延伸來識別 Lambda 授權方的內部結構描述。

更常見的是,在HTTPAPIs和中 RESTAPIs,它也可以用作在共用相同安全性配置的多個作業中定義IAM授權的一種方式。在這種情況下,術語 awsSigv4 是保留字詞,以及任何前綴為 aws 的任何術語。

此延伸套用至「開啟 API 2」和「開啟 API 3」中的apiKey類型安全性配置。

x-amazon-apigateway-authtype 例子

下列 Open API 3 範例會定義RESTAPI或中多個資源的IAM授權 HTTPAPI:

{ "openapi" : "3.0.1", "info" : { "title" : "openapi3", "version" : "1.0" }, "paths" : { "/operation1" : { "get" : { "responses" : { "default" : { "description" : "Default response" } }, "security" : [ { "sigv4Reference" : [ ] } ] } }, "/operation2" : { "get" : { "responses" : { "default" : { "description" : "Default response" } }, "security" : [ { "sigv4Reference" : [ ] } ] } } }, "components" : { "securitySchemes" : { "sigv4Reference" : { "type" : "apiKey", "name" : "Authorization", "in" : "header", "x-amazon-apigateway-authtype": "awsSigv4" } } } }

下列 Open API 3 範例會定義具有自訂配置的 Lambda 授權者:RESTAPI

{ "openapi" : "3.0.1", "info" : { "title" : "openapi3 for REST API", "version" : "1.0" }, "paths" : { "/protected-by-lambda-authorizer" : { "get" : { "responses" : { "200" : { "description" : "Default response" } }, "security" : [ { "myAuthorizer" : [ ] } ] } } }, "components" : { "securitySchemes" : { "myAuthorizer" : { "type" : "apiKey", "name" : "Authorization", "in" : "header", "x-amazon-apigateway-authorizer" : { "identitySource" : "method.request.header.Authorization", "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:account-id:function:function-name/invocations", "authorizerResultTtlInSeconds" : 300, "type" : "request", "enableSimpleResponses" : false }, "x-amazon-apigateway-authtype": "Custom scheme with corporate claims" } } }, "x-amazon-apigateway-importexport-version" : "1.0" }

另請參閱

授權者。 authType