You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(aws-apigateway): add ability to include authorizer context in apigw sfn integration (#18892)
Implements #18891
This PR adds the ability to include custom authorizer context in the Step Functions API Gateway integration. This is useful if the custom authorizer sets custom context values, which can then be used downstream in the step function. This adds a `authorizer: { ... }` key to the state input.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-apigateway/README.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ Other metadata such as billing details, AWS account ID and resource ARNs are not
126
126
127
127
By default, a `prod` stage is provisioned.
128
128
129
-
In order to reduce the payload size sent to AWS Step Functions, `headers` are not forwarded to the Step Functions execution input. It is possible to choose whether `headers`, `requestContext`, `path`and `querystring` are included or not. By default, `headers` are excluded in all requests.
129
+
In order to reduce the payload size sent to AWS Step Functions, `headers` are not forwarded to the Step Functions execution input. It is possible to choose whether `headers`, `requestContext`, `path`, `querystring`, and `authorizer` are included or not. By default, `headers` are excluded in all requests.
130
130
131
131
More details about AWS Step Functions payload limit can be found at https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html#service-limits-task-executions.
132
132
@@ -184,7 +184,7 @@ AWS Step Functions will receive the following execution input:
184
184
}
185
185
```
186
186
187
-
Additional information around the request such as the request context and headers can be included as part of the input
187
+
Additional information around the request such as the request context, authorizer context, and headers can be included as part of the input
188
188
forwarded to the state machine. The following example enables headers to be included in the input but not query string.
189
189
190
190
```ts fixture=stepfunctions
@@ -193,6 +193,7 @@ new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {
* If the whole authorizer object, including custom context values should be in the execution input. The execution input will include a new key `authorizer`:
* If the whole authorizer object, including custom context values should be in the execution input. The execution input will include a new key `authorizer`:
81
+
*
82
+
* {
83
+
* "body": {},
84
+
* "authorizer": {
85
+
* "key": "value"
86
+
* }
87
+
* }
88
+
*
89
+
* @default false
90
+
*/
91
+
readonlyauthorizer?: boolean;
78
92
}
79
93
80
94
/**
@@ -96,6 +110,7 @@ export class StepFunctionsRestApi extends RestApi {
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.expected.json
+2-2
Original file line number
Diff line number
Diff line change
@@ -185,11 +185,11 @@
185
185
"Fn::Join": [
186
186
"",
187
187
[
188
-
"## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = true)\n#set($includeQueryString = false)\n#set($includePath = false)\n#set($allParams = $input.params())\n{\n\"stateMachineArn\": \"",
188
+
"## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = true)\n#set($includeQueryString = false)\n#set($includePath = false)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n\"stateMachineArn\": \"",
"## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"",
55
+
"## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"",
0 commit comments