Repository navigation
Add runtime auth via X-Mapped-Auth header - #36
Merged
Merged
Conversation
Allow clients to authenticate outbound API calls at request time using the X-Mapped-Auth header instead of storing credentials in the route. When a route has no pre-configured authHeader, the middleware applies X-Mapped-Auth (Bearer/Basic/raw) for the validation call during route creation and for every subsequent request to that route. Stored routes never persist the runtime token. Pre-configured authHeader always takes priority over X-Mapped-Auth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
X-Mapped-Auth: Bearer <token>(or Basic/raw) instead of storing credentials in the route bodyPOST /v1/mapping, the runtime token is used to validate the route against the external API but is never persisted — every future call to that route must supplyX-Mapped-AuthGET|POST|... /v1/{uuid}/path, if the route has no pre-configuredauthHeader, the middleware appliesX-Mapped-Authfor the outbound call; pre-configured auth always takes prioritydocumentation/MappingRequest.mdwith both authentication options and priority rulesTest plan
MiddlewareAuthHeaderTest— 6 unit tests forMiddlewareAuthHeader.fromString(Bearer, Basic, lowercase, raw token, unknown prefix, multi-word token)ServerServiceImplTest— 7 new integration tests: X-Mapped-Auth applied on dynamic route, Basic variant, pre-configured auth takes priority, header not leaked to forwarded headers, null when absent, runtime auth passed through mapping creation, null when not provided on creationMiddlewareRepositoryimplTest— 5 new tests: validation uses runtime auth, stored route has null auth, pre-configured auth wins over runtime, null auth when neither provided, route gets correct UUID path after creation🤖 Generated with Claude Code