Skip to content

add support for Cognito Inbound federation Lambda trigger#619

Open
maximrub wants to merge 1 commit intoaws:mainfrom
maximrub:inbound-federation
Open

add support for Cognito Inbound federation Lambda trigger#619
maximrub wants to merge 1 commit intoaws:mainfrom
maximrub:inbound-federation

Conversation

@maximrub
Copy link

Description of changes:
Add support for the new https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-inbound-federation.html for Amazon Cognito User Pools. This trigger is invoked when a user signs in through a third-party identity provider, allowing a Lambda to inspect and transform federated user attributes before they are mapped to the user pool.

New types:

  • CognitoFederationProviderType — string enum with constants for all supported provider types (OIDC, SAML, Facebook, Google, SignInWithApple, LoginWithAmazon)
  • CognitoEventUserPoolsInboundFederation — top-level event struct
  • CognitoEventUserPoolsInboundFederationRequest — with ProviderName, ProviderType, and Attributes
  • CognitoEventUserPoolsInboundFederationAttributes — with TokenResponse, IDToken, UserInfo (OIDC/social) and SAMLResponse (SAML), all map[string]string
  • CognitoEventUserPoolsInboundFederationResponse — with UserAttributesToMap as map[string]string

All attribute maps use map[string]string per confirmation from the Cognito team that these fields contain string-only types today, and any future non-string types would be released as a new generation trigger (V2).

Tests:

  • OIDC round-trip marshaling test with test fixture
  • SAML round-trip marshaling test with test fixture
  • Malformed JSON test

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

Signed-off-by: Maxim Rubchinsky <maxim@rubchinsky.com>
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.94%. Comparing base (71624ac) to head (ebe38d9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #619   +/-   ##
=======================================
  Coverage   74.94%   74.94%           
=======================================
  Files          36       36           
  Lines        1401     1401           
=======================================
  Hits         1050     1050           
  Misses        273      273           
  Partials       78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants