Skip to content

feat: read the Event API user pool identity in util.authType() - #349

Merged
bentsku merged 2 commits into
mainfrom
events-user-pool-auth-type
Nov 13, 2026
Merged

bentsku merged 2 commits into
mainfrom
events-user-pool-auth-type

Conversation

@bentsku

@bentsku bentsku commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

An Event API hands its handlers a user pool identity that has no defaultAuthStrategy:

{ claims, groups, issuer, sourceIp, sub, username }

AWS reports that request as User Pool Authorization. The identity schemas util.authType() matches against are the GraphQL ones, where defaultAuthStrategy is required, so this identity falls through to API Key Authorization.

What this does

When ctx.info.channelNamespace is set (an Event API context), util.authType() first tries a user pool schema without defaultAuthStrategy, then the existing schemas. GraphQL contexts are unchanged, so a GraphQL user pool identity missing defaultAuthStrategy still isn't read as a user pool request.

The OIDC identity of an Event API ({ claims, issuer, sub }) already matches the existing OIDC schema.

Tests

Four new cases in __tests__/authType.test.js for Event API contexts: the user pool identity with and without groups, a user pool identity missing sourceIp (still an API key request), and the OIDC identity. The full suite passes.

🤖 Generated with Claude Code

An Event API hands its handlers a user pool identity without
defaultAuthStrategy, and AWS reports it as User Pool Authorization. The
GraphQL schemas read that shape as an API key request, so an Event API
context (one whose ctx.info names a channel namespace) gets its own user
pool schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bentsku
bentsku marked this pull request as ready for review November 13, 2026 21:10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bentsku
bentsku merged commit bbc1845 into main Nov 13, 2026
4 checks passed
@bentsku
bentsku deleted the events-user-pool-auth-type branch November 13, 2026 21:38
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.

1 participant