-
Notifications
You must be signed in to change notification settings - Fork 489
Add AWS AppSyncEvent #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add AWS AppSyncEvent #1939
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
64d401c
Initial changes for AppSyncEvent
4335914
Added AppSyncEvent class, and respective test cases
ankushjain358 f287562
Updated README
ankushjain358 1bb2045
Update readme
033f1e8
Update Arguments type in event
204e17a
Update schema
87f899a
fix review comment
8ebea50
Added Lambda and oidc auth type
24aafb0
Update readme
634f4a4
Added changefile
2fdb768
merge from master
0ad9cd6
Added AuthorizerEvent and Result
f2af59d
update changefile and readme
247a2be
Update JsonProperty attribute
4356b85
Test case updated
9b8f7ae
Added new tests, updated readme and incorporated review comments
ankushjain358 f94d588
Updated README
ankushjain358 5180735
Updated README
ankushjain358 0708f45
fixed code review comments
d7cd825
fixed formatting
1c34513
Revert warning and remove condition
1530839
Merge branch 'aws:master' into add-aws-appsync-event
PankajRawat333 06fe270
Added .net8 directive
308156c
Remove warning
e37ad36
fixed review comments
3990078
fix formatting
25190da
Refactor .NET8 and 6 test
d2469ca
Moved AppSync tests to a new prpject
ankushjain358 11723b0
Merge remote-tracking branch 'upstream/dev' into add-aws-appsync-event
ankushjain358 089f411
Reverted EventTests file
ankushjain358 e74bda3
Merge remote-tracking branch 'upstream/dev' into add-aws-appsync-event
ankushjain358 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.autover/changes/78ee1265-f50d-434a-b25c-fcb8e9e7a26a.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Projects": [ | ||
{ | ||
"Name": "Amazon.Lambda.AppSyncEvents", | ||
"Type": "Major", | ||
"ChangelogMessages": [ | ||
"Added AppSyncResolverEvent to support direct lambda resolver" | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Libraries/src/Amazon.Lambda.AppSyncEvents/Amazon.Lambda.AppSyncEvents.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="..\..\..\buildtools\common.props" /> | ||
|
||
<PropertyGroup> | ||
<Description>Amazon Lambda .NET support - AWS AppSync package.</Description> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<AssemblyTitle>Amazon.Lambda.AppSyncEvents</AssemblyTitle> | ||
<Version>0.0.1</Version> | ||
<AssemblyName>Amazon.Lambda.AppSyncEvents</AssemblyName> | ||
<PackageId>Amazon.Lambda.AppSyncEvents</PackageId> | ||
<PackageTags>AWS;Amazon;Lambda</PackageTags> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<WarningsAsErrors>IL2026,IL2067,IL2075,IL3050</WarningsAsErrors> | ||
<IsTrimmable>true</IsTrimmable> | ||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> | ||
</PropertyGroup> | ||
|
||
</Project> |
65 changes: 65 additions & 0 deletions
65
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncAuthorizerEvent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents an AWS AppSync authorization event that is sent to a Lambda authorizer | ||
/// for evaluating access permissions to the GraphQL API. | ||
/// </summary> | ||
public class AppSyncAuthorizerEvent | ||
{ | ||
/// <summary> | ||
/// Gets or sets the authorization token received from the client request. | ||
/// This token is used to make authorization decisions. | ||
/// </summary> | ||
public string AuthorizationToken { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the headers from the client request. | ||
/// Contains key-value pairs of HTTP header names and their values. | ||
/// </summary> | ||
public Dictionary<string, string> RequestHeaders { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the context information about the AppSync request. | ||
/// Contains metadata about the API and the GraphQL operation being executed. | ||
/// </summary> | ||
public AppSyncRequestContext RequestContext { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Contains contextual information about the AppSync request being authorized. | ||
/// This class provides details about the API, account, and GraphQL operation. | ||
/// </summary> | ||
public class AppSyncRequestContext | ||
{ | ||
/// <summary> | ||
/// Gets or sets the unique identifier of the AppSync API. | ||
/// </summary> | ||
public string ApiId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the AWS account ID where the AppSync API is deployed. | ||
/// </summary> | ||
public string AccountId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the unique identifier for this specific request. | ||
/// </summary> | ||
public string RequestId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the GraphQL query string containing the operation to be executed. | ||
/// </summary> | ||
public string QueryString { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the GraphQL operation to be executed. | ||
/// This corresponds to the operation name in the GraphQL query. | ||
/// </summary> | ||
public string OperationName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the variables passed to the GraphQL operation. | ||
/// Contains key-value pairs of variable names and their values. | ||
/// </summary> | ||
public Dictionary<string, object> Variables { get; set; } | ||
} |
33 changes: 33 additions & 0 deletions
33
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncAuthorizerResult.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Text.Json.Serialization; | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents the authorization result returned by a Lambda authorizer to AWS AppSync | ||
/// containing authorization decisions and optional context for the GraphQL API. | ||
/// </summary> | ||
public class AppSyncAuthorizerResult | ||
{ | ||
/// <summary> | ||
/// Indicates if the request is authorized | ||
/// </summary> | ||
[JsonPropertyName("isAuthorized")] | ||
public bool IsAuthorized { get; set; } | ||
|
||
/// <summary> | ||
/// Custom context to pass to resolvers, only supports key-value pairs. | ||
/// </summary> | ||
[JsonPropertyName("resolverContext")] | ||
public Dictionary<string, string> ResolverContext { get; set; } | ||
|
||
/// <summary> | ||
/// List of fields that are denied access | ||
/// </summary> | ||
[JsonPropertyName("deniedFields")] | ||
public IEnumerable<string> DeniedFields { get; set; } | ||
|
||
/// <summary> | ||
/// The number of seconds that the response should be cached for | ||
/// </summary> | ||
[JsonPropertyName("ttlOverride")] | ||
public int? TtlOverride { get; set; } | ||
} |
42 changes: 42 additions & 0 deletions
42
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncCognitoIdentity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents Amazon Cognito User Pools authorization identity for AppSync | ||
/// </summary> | ||
public class AppSyncCognitoIdentity | ||
{ | ||
/// <summary> | ||
/// The source IP address of the caller received by AWS AppSync | ||
/// </summary> | ||
public List<string> SourceIp { get; set; } | ||
|
||
/// <summary> | ||
/// The username of the authenticated user | ||
/// </summary> | ||
public string Username { get; set; } | ||
|
||
/// <summary> | ||
/// The UUID of the authenticated user | ||
/// </summary> | ||
public string Sub { get; set; } | ||
|
||
/// <summary> | ||
/// The claims that the user has | ||
/// </summary> | ||
public Dictionary<string, object> Claims { get; set; } | ||
|
||
/// <summary> | ||
/// The default authorization strategy for this caller (ALLOW or DENY) | ||
/// </summary> | ||
public string DefaultAuthStrategy { get; set; } | ||
|
||
/// <summary> | ||
/// List of OIDC groups | ||
/// </summary> | ||
public List<string> Groups { get; set; } | ||
|
||
/// <summary> | ||
/// The token issuer | ||
/// </summary> | ||
public string Issuer { get; set; } | ||
} |
47 changes: 47 additions & 0 deletions
47
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncIamIdentity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents AWS IAM authorization identity for AppSync | ||
/// </summary> | ||
public class AppSyncIamIdentity | ||
{ | ||
/// <summary> | ||
/// The source IP address of the caller received by AWS AppSync | ||
/// </summary> | ||
public List<string> SourceIp { get; set; } | ||
|
||
/// <summary> | ||
/// The username of the authenticated user (IAM user principal) | ||
/// </summary> | ||
public string Username { get; set; } | ||
|
||
/// <summary> | ||
/// The AWS account ID of the caller | ||
/// </summary> | ||
public string AccountId { get; set; } | ||
|
||
/// <summary> | ||
/// The Amazon Cognito identity pool ID associated with the caller | ||
/// </summary> | ||
public string CognitoIdentityPoolId { get; set; } | ||
|
||
/// <summary> | ||
/// The Amazon Cognito identity ID of the caller | ||
/// </summary> | ||
public string CognitoIdentityId { get; set; } | ||
|
||
/// <summary> | ||
/// The ARN of the IAM user | ||
/// </summary> | ||
public string UserArn { get; set; } | ||
|
||
/// <summary> | ||
/// Either authenticated or unauthenticated based on the identity type | ||
/// </summary> | ||
public string CognitoIdentityAuthType { get; set; } | ||
|
||
/// <summary> | ||
/// A comma separated list of external identity provider information used in obtaining the credentials used to sign the request | ||
/// </summary> | ||
public string CognitoIdentityAuthProvider { get; set; } | ||
} |
13 changes: 13 additions & 0 deletions
13
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncLambdaIdentity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents AWS Lambda authorization identity for AppSync | ||
/// </summary> | ||
public class AppSyncLambdaIdentity | ||
{ | ||
/// <summary> | ||
/// Optional context information that will be passed to subsequent resolvers | ||
/// Can contain user information, claims, or any other contextual data | ||
/// </summary> | ||
public Dictionary<string, string> ResolverContext { get; set; } | ||
} |
22 changes: 22 additions & 0 deletions
22
Libraries/src/Amazon.Lambda.AppSyncEvents/AppSyncOidcIdentity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Amazon.Lambda.AppSyncEvents; | ||
|
||
/// <summary> | ||
/// Represents OpenID Connect authorization identity for AppSync | ||
/// </summary> | ||
public class AppSyncOidcIdentity | ||
{ | ||
/// <summary> | ||
/// Claims from the OIDC token as key-value pairs | ||
/// </summary> | ||
public Dictionary<string, object> Claims { get; set; } | ||
|
||
/// <summary> | ||
/// The issuer of the OIDC token | ||
/// </summary> | ||
public string Issuer { get; set; } | ||
|
||
/// <summary> | ||
/// The UUID of the authenticated user | ||
/// </summary> | ||
public string Sub { get; set; } | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you add IL3050?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, added by mistake