[WIP] Allow accepting JWT tokens from other CARDs instances - #2388
Closed
OrdiNeu wants to merge 12 commits into
Closed
[WIP] Allow accepting JWT tokens from other CARDs instances#2388OrdiNeu wants to merge 12 commits into
OrdiNeu wants to merge 12 commits into
Conversation
OrdiNeu
force-pushed
the
ia45/foreign-jwt-auth
branch
from
July 13, 2026 16:38
4b9f4ea to
6728389
Compare
Fixup a test where it was being signed with a HS512 key still
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
OrdiNeu
force-pushed
the
ia45/foreign-jwt-auth
branch
from
July 13, 2026 16:42
6728389 to
62b1160
Compare
Apply code review changes by Claude
OrdiNeu
marked this pull request as ready for review
July 13, 2026 17:55
Member
Author
|
Closed as it's been moved to IAP (see data-team-uhn/iap#40 ) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
For the hub-and-spoke principle that we're hoping to use, it'll be convenient for us to pass JWT tokens between CARDS instances (for example, to pass updates on a form from one instance to another). This PR introduces a few things that allow this:
To Test
audBuilder.add("localhost8081");toCardsJwtTokenManagerImpl:152and start via./start_cards.sh --dev --testexport CARDS_HOST_AND_PORT=localhost:8081and then run./start_cards.sh --dev --test -p 8081You'll notice, under

/bin/browser.html, that the JWTSigningKey has been moved to a node namedJWTRSA256Keyreplaced with an asymmetric key:You'll also notice, after creating a Survey for the new patient and logging in as that patient, that the structure of the JWT in the

cards_auth_tokenhas changedYou can then create a new Node
/jcr:system/cards:jwt/localhost8080(EDIT: you now need to use the hex representation of the hash of the public key as the node name) to the second instance, with property "verify" equal to the "verify" token from the first instance. If you login to the second instance as a Visit subject, and then replace thecards_auth_tokencookie with its value from the first instance, it will not crash when you refresh the page.This code is technically backwards compatible with running instances of Cards, retaining the ability to decode tokens under the previous encryption scheme. However, it will no longer mint new Tokens using the old symmetric key.
Future work