Skip to content

Add cognito authentication flow token schema support.#68

Merged
Duslerke merged 20 commits intoreleasefrom
feature/add-cognito-token-support
Feb 25, 2026
Merged

Add cognito authentication flow token schema support.#68
Duslerke merged 20 commits intoreleasefrom
feature/add-cognito-token-support

Conversation

@Duslerke
Copy link
Contributor

What:

  • Decouple the token presentation concern from domain logic.
  • Add conditional token Google Groups key construction based on incoming token schema (groups are either in Groups or CustomGroups).

Why:

  • Old Hackney authentication flow expects the incoming token to contain Google groups within Groups field encoded as JSON Array. However, the new schema aims to reduce the size of hackney token (due to 4kB cookie size limitation) by cutting out all the JSON syntax (which analysis shows increases token size by ~11%) and replacing it with ; separator joined string. Additionally, within the new token schema Google groups are stored under custom:groups key.

Notes:

  • I've updated the JWT tests setup to use generated tokens instead of using the hardcoded one. Done this to prevent having something that looks like real secrets in the code base needlessly alarming developers. Also did this to reduce the git guardian noise.
  • The hardcoded token I removed was a dummy token with values that match hardcoded values within one of the tests I've modified.

This is so that both the old token format, and the new Cognito token format both get supported at the same time w/o any changes to the domain logic.
…o the tests helper generated token can be signed.
…WT token structure that tests helper needs to create.
…ema type.

This is because in reality, regardless of what schema is expected under the hood, the parse schema representing incoming data will always be TokenPresentation, just with different keys.
All this rule ensures is that tests names are unreadable.
… our controlled values rather than jwt generator defaults.
… with dynamically generated one to prevent future gitguardian noise.
…to' token schema in addition to the old Hackney token schema.
…mGroups' case that compiler forces to address.
…r presentation layer tests only (jwt str + token obj), meaning only TokenPresentation is needed for the setups. Removed code is remanants of a different approach.
Copy link

@manimaran-ramalingam manimaran-ramalingam left a comment

Choose a reason for hiding this comment

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

Approved

This was referenced Feb 25, 2026
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