Describe the feature
Implement TokenSmith-backed service token exchange and integrate it into SMD client request auth,
with static JWT fallback retained.
Why do you want this feature?
Current branch only supports static SMD auth; feature/fabrica-0.3.0 includes dynamic token
exchange/refresh needed for service-to-service auth hygiene.
Scope
A) Service token manager
- Add
ServiceTokenManager with:
- bootstrap token exchange
- refresh-if-needed API
- periodic background refresh
- stats/introspection helpers
- Add unit tests for:
- successful bootstrap + refresh
- retry/error behavior
- endpoint-aware error surfacing
B) Server config and startup wiring
- Add config/flags/env for:
tokensmith_url
tokensmith_bootstrap_token
tokensmith_target_service
tokensmith_scopes
tokensmith_refresh_skew_sec
- Update SMD client initialization flow to:
- use static JWT (
SMD_JWT/SMD_TOKEN) when TokenSmith is not configured
- initialize TokenSmith manager when configured
- start background refresh loop with server context
C) HTTP client auth integration
- Update SMD HTTP client to attach bearer token from service token manager on requests.
- Preserve behavior when manager is absent (static token mode).
Acceptance Criteria
- Service starts in static mode without TokenSmith config.
- Service starts in TokenSmith mode with valid bootstrap token and refreshes token over time.
- Outbound SMD calls carry dynamic bearer token when TokenSmith mode is enabled.
- Unit tests cover manager lifecycle and auth header behavior.
Alternatives you've considered
I considered doing...
Additional context
No response
Code of Conduct
Describe the feature
Implement TokenSmith-backed service token exchange and integrate it into SMD client request auth,
with static JWT fallback retained.
Why do you want this feature?
Current branch only supports static SMD auth;
feature/fabrica-0.3.0includes dynamic tokenexchange/refresh needed for service-to-service auth hygiene.
Scope
A) Service token manager
ServiceTokenManagerwith:B) Server config and startup wiring
tokensmith_urltokensmith_bootstrap_tokentokensmith_target_servicetokensmith_scopestokensmith_refresh_skew_secSMD_JWT/SMD_TOKEN) when TokenSmith is not configuredC) HTTP client auth integration
Acceptance Criteria
Alternatives you've considered
I considered doing...
Additional context
No response
Code of Conduct