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
Copy file name to clipboardExpand all lines: Libraries/src/Amazon.Lambda.AppSyncEvents/README.md
+34-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This package contains classes that can be used as input types for Lambda functions that process AppSync events.
4
4
5
-
# Sample Function
5
+
##Sample Function
6
6
7
7
The following is a sample class and Lambda function that receives AppSync resolver event record data as an `appSyncResolverEvent` and logs some of the incoming event data. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
8
8
@@ -36,3 +36,36 @@ public void Handler(AppSyncResolverEvent<Dictionary<string, object>> appSyncReso
36
36
}
37
37
}
38
38
```
39
+
40
+
## Example of Custom Lambda Authorizer
41
+
This example demonstrates how to implement a custom Lambda authorizer for AppSync using the AppSync Events package. The authorizer function receives an `AppSyncAuthorizerEvent` containing the authorization token and request context. It returns an `AppSyncAuthorizerResult` that determines whether the request is authorized and includes additional context.
42
+
43
+
The function also provides some data in the `resolverContext` object. This information is available in the AppSync resolver’s context `identity` object.
44
+
45
+
```
46
+
public async Task<AppSyncAuthorizerResult> CustomLambdaAuthorizerHandler(AppSyncAuthorizerEvent appSyncAuthorizerEvent)
47
+
{
48
+
var authorizationToken = appSyncAuthorizerEvent.AuthorizationToken;
49
+
var apiId = appSyncAuthorizerEvent.RequestContext.ApiId;
50
+
var accountId = appSyncAuthorizerEvent.RequestContext.AccountId;
0 commit comments