CAMEL-23305: Add camel-spiffe example (workload identity with SPIFFE and SPIRE) - #260
Open
oscerd wants to merge 1 commit into
Open
CAMEL-23305: Add camel-spiffe example (workload identity with SPIFFE and SPIRE)#260oscerd wants to merge 1 commit into
oscerd wants to merge 1 commit into
Conversation
…and SPIRE) A Docker Compose example for the camel-spiffe component: a SPIRE server and agent issue identities to four Camel Main applications, which authenticate each other with JWT-SVIDs (fetchJwtSvid / validateJwtSvid), authorize by SPIFFE ID with per-route allow-lists in a shared route configuration, make a second hop with their own identity, and log their rotating X.509-SVIDs (fetchX509Svid). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
oscerd
force-pushed
the
feature/CAMEL-23305-spiffe-example
branch
from
September 4, 2026 09:48
824bb37 to
dd6f528
Compare
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.
What
A new
spiffeexample (category Security) for thecamel-spiffecomponent that ships in Camel 4.23 (CAMEL-23305).It runs four Camel Main applications and a SPIRE deployment with Docker Compose, all in the trust domain
example.org:frontendspiffe://example.org/frontendGET /api/orderson the backend (200); the audit trail is denied (403)auditorspiffe://example.org/auditorGET /api/auditon the backend (200); the orders are denied (403)backendspiffe://example.org/backendinventoryspiffe://example.org/inventoryAll three operations of the component are used:
fetchJwtSvid: the clients get JWT-SVIDs minted for the backend and present them as bearer tokens; the backend does the same towards the inventory (second hop), passing the original caller along for auditing. Thewrong-audienceroute uses theCamelSpiffeAudienceheader to request a token for another service, which the backend rejects (401).validateJwtSvid: a shared workload identity policy (a route configuration withinterceptFrom+onException) validates the token, checks the caller against per-route allow-lists inapplication.properties, and records an audit trail, before the routes run.fetchX509Svid: every application logs a summary of its X.509-SVID once a minute, which shows the rotation done by the SPIRE agent.The
auditorruns the very same code and image as thefrontend, but as another Unix user, so the SPIRE agent gives it another identity with opposite permissions: identity comes from the platform, not from the code.Infrastructure
spirecontainer copies the SPIRE 1.15.3 server and agent binaries into Alpine and bootstraps everything (join token, trust bundle, registration entries withunix:uidselectors).unixworkload attestor can see them, and run as distinct uids.io.spiffe:grpc-netty-linuxis added at runtime scope:java-spiffe-corepulls no gRPC transport for the Unix domain socket (the README documents the macOS artifacts).Tests
16 unit tests run without SPIRE: a Mockito mock of
WorkloadApiClientis bound to the registry and autowired by the component. The backend and the inventory are tested over HTTP on the embedded server of Camel Main (JDKHttpClient), the backend test stubs the inventory on the same server to check the second hop.Verified end to end on Linux with
docker compose up --build: 200/403/401 matrix, second hop withX-On-Behalf-Of, X.509-SVID rotation at half TTL, and no token or on-behalf-of header leaking into HTTP responses. Apache RAT passes.The root
README.adocindex was regenerated with./mvnw -N process-resources(it also drops the two removed csimple examples from the count).🤖 Generated with Claude Code