Issue and validate a SPIFFE JWT-SVID for service-to-service authorization in an HTTP header

domain: spiffe.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Ensure the workload entry exists in SPIRE for the calling service with the appropriate selector
  2. From the caller workload, obtain a JWT-SVID for a specific audience using the go-spiffe SDK: 'source.FetchJWTSVID(ctx, jwtsvid.Params{Audience: "spiffe://example.org/downstream"})' or via CLI: 'spire-agent api fetch jwt -audience spiffe://example.org/downstream -socketPath /run/spire/sockets/agent.sock'
  3. Pass the JWT in the Authorization header: 'Authorization: Bearer <JWT_SVID_TOKEN>'
  4. On the receiving service, validate using go-spiffe: 'jwtsvid.ParseAndValidate(token, jwtSource, []string{"spiffe://example.org/downstream"})' which checks signature, expiry, and audience
  5. Inspect the validated SVID's ID field ('svid.ID.String()') to authorize based on the caller's SPIFFE ID
  6. Handle token rotation by re-fetching the JWT-SVID before each outbound request, as JWT-SVIDs have a short TTL (typically 5 minutes)

Known gotchas

Related routes

Configure SPIFFE federation between two trust domains and verify cross-domain JWT-SVID validation
spiffe.io · 6 steps · unrated
Understand SPIFFE SVID types (X.509-SVID and JWT-SVID) and when to use each
spiffe.io · 6 steps · unrated
Implement mutual TLS service-to-service communication using SPIFFE identities for authorization
spiffe.io · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans