Smart backend services - #46
Merged
Merged
Conversation
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 28, 2026 12:21
038f662 to
fa9ccdc
Compare
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 28, 2026 14:15
bac954e to
3abb534
Compare
spicyfalafel
force-pushed
the
smart-backend-services
branch
2 times, most recently
from
January 28, 2026 14:48
5483056 to
e1b35c2
Compare
spicyfalafel
force-pushed
the
smart-backend-services
branch
2 times, most recently
from
January 28, 2026 15:19
6cfdfb2 to
92890b2
Compare
Aitem
reviewed
Jan 28, 2026
Aitem
left a comment
Member
There was a problem hiding this comment.
Use real smart app instead mock
Member
|
Basically, by code organization, it's ok for me |
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 29, 2026 09:15
3f1691b to
63920b9
Compare
spicyfalafel
marked this pull request as draft
January 29, 2026 10:07
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 29, 2026 11:38
96b5c79 to
11685f6
Compare
Implement SMART Backend Services authentication per HL7 spec: - JWT-based client credentials flow with RS384 and ES384 signing - Discovery via .well-known/smart-configuration endpoint - Token caching with automatic refresh - generateKeyPair() helper for RSA and EC key generation Also includes: - Export isAuthenticated from AuthProvider interface - CI workflow for e2e tests with Aidbox - vitest config for sequential test execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove mocks and test against real Aidbox instance: - Integration tests for token acquisition and FHIR operations - Tests for generateKeyPair() with RS384 and ES384 - Proper test isolation with table truncation in beforeAll Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 29, 2026 11:44
11685f6 to
2ae913a
Compare
spicyfalafel
marked this pull request as ready for review
January 29, 2026 11:46
Contributor
Author
|
@rublag-hs please take a look |
rublag-hs
requested changes
Jan 29, 2026
rublag-hs
left a comment
Collaborator
There was a problem hiding this comment.
Are there any widespread libraries to interact with OAuth2/OIDC? Maybe we can use them instead of reinventing the wheel?
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 29, 2026 18:22
0c8a2ef to
47f1bfa
Compare
spicyfalafel
force-pushed
the
smart-backend-services
branch
from
January 29, 2026 18:30
47f1bfa to
92bbad8
Compare
rublag-hs
requested changes
Jan 30, 2026
rublag-hs
approved these changes
Feb 2, 2026
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.
Summary
Add SMART Backend Services authentication provider for server-to-server OAuth 2.0 authentication per HL7 spec.
Uses oauth4webapi library for OAuth 2.0 implementation.
Features
.well-known/smart-configurationendpointtokenExpirationBuffer).tee())Also includes
validateBaseUrlandmergeHeadersutilities extracted to sharedutils.tsUsage
Test plan
Documentation
Note
Medium Risk
Introduces new OAuth/token-handling logic (caching, retry, discovery) and changes request header/baseUrl validation behavior in auth providers; functional risk is moderate despite added integration coverage.
Overview
Adds a new
SmartBackendServicesAuthProviderto@health-samurai/aidbox-clientfor SMART Backend Services (OAuth 2.0client_credentialswith private-key JWT), including OAuth discovery, token caching/refresh, concurrent token-request deduplication, and a single 401 retry.Refactors existing auth providers to share new
validateBaseUrlandmergeHeadershelpers, and updates docs/exports/dependencies (oauth4webapi) accordingly.Expands integration testing: new end-to-end tests for SMART backend services (including on-the-fly keypair/JWKS setup in Aidbox), more deterministic FHIR HTTP tests with DB cleanup, and forces Vitest to run files sequentially; also updates
.gitignorefor local/dev artifacts.Written by Cursor Bugbot for commit 017a933. This will update automatically on new commits. Configure here.