Skip to content

Add runtime auth via X-Mapped-Auth header - #36

Merged
LeonardoBai12 merged 2 commits into
mainfrom
lbai/feat/runtime-auth-header
Jun 22, 2026
Merged

LeonardoBai12 merged 2 commits into
mainfrom
lbai/feat/runtime-auth-header

Conversation

@LeonardoBai12

Copy link
Copy Markdown
Owner

Summary

  • Clients can now pass X-Mapped-Auth: Bearer <token> (or Basic/raw) instead of storing credentials in the route body
  • During POST /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 supply X-Mapped-Auth
  • During GET|POST|... /v1/{uuid}/path, if the route has no pre-configured authHeader, the middleware applies X-Mapped-Auth for the outbound call; pre-configured auth always takes priority
  • Updated documentation/MappingRequest.md with both authentication options and priority rules

Test plan

  • MiddlewareAuthHeaderTest — 6 unit tests for MiddlewareAuthHeader.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 creation
  • MiddlewareRepositoryimplTest — 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
  • All existing tests continue to pass

🤖 Generated with Claude Code

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>
@LeonardoBai12 LeonardoBai12 self-assigned this Jun 22, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LeonardoBai12
LeonardoBai12 merged commit 89c8a81 into main Jun 22, 2026
2 checks passed
@LeonardoBai12
LeonardoBai12 deleted the lbai/feat/runtime-auth-header branch June 22, 2026 20:27
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