Skip to content
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

add AppSyncIdentity #173

Merged
merged 6 commits into from
Mar 15, 2019
Merged

add AppSyncIdentity #173

merged 6 commits into from
Mar 15, 2019

Conversation

daviskoh
Copy link
Contributor

Issue #, if available:

Description of changes:

Adds new AppSyncIdentity struct which represents the .identity field of context. Other context fields are left out because they are all custom structures that depend on user implementation.

One thing to note is that AppSyncIdentity.Claims is of type map[string]interface{} which sucks, but Claims values can be either Number or String json types and there may be custom claims added by the user...

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-io
Copy link

codecov-io commented Feb 27, 2019

Codecov Report

Merging #173 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #173   +/-   ##
=======================================
  Coverage   77.12%   77.12%           
=======================================
  Files          18       18           
  Lines         634      634           
=======================================
  Hits          489      489           
  Misses        104      104           
  Partials       41       41

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e12c711...94892a1. Read the comment docs.

@@ -9,6 +9,20 @@ type AppSyncResolverTemplate struct {
Payload json.RawMessage `json:"payload"`
}

// AppSyncIdentity contains information about the caller. The shape of this section depends on the authorization type of your AWS AppSync API
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that there'd need to be 2 types added, rather than the union of both shapes. https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html

  • AppSyncIAMIdentity
  • AppSyncCognitoIdentity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unmarshalling / marshalling $context.identity into the single type works either way, but I'll separate out the type if that's what's desired.

@daviskoh
Copy link
Contributor Author

hmmm also noticing now the test are off...will ping you when resolved.

* fix tests to check marshalling / unmarshalling of identity json
@daviskoh
Copy link
Contributor Author

@bmoffatt i've updated everything:

  • separated out AppSyncIdentity into separate types for IAM & Cognito
  • fixed tests to actually check marshalling / unmarshalling of identity json

u mind having a look? 😃

Arn -> ARN
Id -> ID
Ip -> IP
Copy link
Collaborator

@bmoffatt bmoffatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bmoffatt bmoffatt merged commit b3e2820 into aws:master Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants