How strongdm/agentic-auth works
1. This repository is a collection of self-contained StrongDM ID examples, not a single product application. The common architectural theme is identity: clients obtain StrongDM-issued credentials, and services enforce authentication, delegated authorization, and token-bound trust.
2. The central external dependency is StrongDM ID itself. The repo documents and exercises its main surfaces: agent/client registration, token issuance, token introspection, JWKS/discovery, revocation, userinfo, DPoP, and SPIFFE/JWT-SVID support. Realm-qualified endpoints are a first-class boundary, so most examples are built to work against a tenant-specific issuer.
3. The dominant request flow is: register or enroll a client/agent, activate it, obtain an access token, then call a protected API. On the server side, middleware validates JWTs against StrongDM ID’s keys or introspection and checks scopes; on the client side, some examples also attach proof-of-possession material such as DPoP.
4. examples/flask-middleware is a minimal Python web boundary around Flask. app.py defines protected routes, while strongdm_auth.py encapsulates the StrongDM-specific verification and scope checks. This example is about inserting auth policy in front of ordinary Flask handlers.
5. examples/go-middleware is the Go equivalent for net/http. main.go hosts protected endpoints, strongdmauth.go provides the auth middleware and scope enforcement, and client/main.go demonstrates the full enrollment-to-API-call lifecycle from the command line. This example shows both server enforcement and client bootstrap in one package.
6. examples/nextjs-middleware applies the same boundary at the framework edge. middleware.ts is the interception layer, lib/strongdm-auth.ts holds the validation logic, and the app/api/*/route.ts files are the protected handlers. The architecture is route-driven: middleware decides access before the route code runs.
7. examples/agentkey is a fuller web application built with Swift/Vapor. It has a classic layered structure: auth models and middleware under Sources/App/Auth, request handlers under Controllers/Web and Controllers/API, persistence models and migrations under Models and Migrations, and Leaf templates plus static assets under Resources and Public. It looks like the most complete end-user-facing demo, with dashboards for agents, keys, proofs, profiles, search, and verification.
8. Within agentkey, the data boundary is persistent state plus web presentation. The migrations create the backing tables for agents, public keys, proofs, activity logs, and sponsorship metadata; controllers read/write those models; templates render the dashboard and public pages; and the API controllers expose machine-readable endpoints, including the OpenAPI spec in Public/openapi.yaml.
9. examples/dpop-client is purely client-side and focuses on sender-constrained tokens. The Go, Python, and TypeScript variants all generate a key pair, create a DPoP proof, and use it when requesting or calling token-bound endpoints. There is no server component here; the architectural point is how the client proves possession of its private key.
10. examples/spiffe-client is another client-only identity example, but for workload identity. Its Go, Python, and TypeScript implementations fetch the SPIFFE trust bundle and request JWT-SVIDs, showing how StrongDM ID can participate in service-to-service trust rather than end-user web auth.
11. examples/secure-rag-pipeline is the most distributed example. A Python orchestrator coordinates the workflow, while separate containerized MCP servers handle document access, vector retrieval, ranking, and LLM generation. Shared auth code under mcp-servers/shared suggests each service is individually protected, and docker-compose.yml wires the whole pipeline together. The data flow is ingest/query orchestration rather than a standard HTTP app.
12. Supporting material in the repo matters architecturally because it documents intended flows rather than adding runtime logic: DIALTONE-DEMO.md and USE-CASES.md explain the auth lifecycle and integration patterns, while scripts/forum-post.py appears to be a standalone helper script outside the main examples.
13. If you draw this repo, the best top-level diagram is a hub-and-spoke model: StrongDM ID in the center, with independent example applications around it. Some spokes are API protectors, some are token-issuing clients, one is a full Swift web app, and one is a multi-service RAG pipeline with an orchestrator plus specialized backends.
Main entry points: graph.py Orchestrator · docker-compose.yml Compose file · auth.py Shared auth · StrongDMAuth.swift Auth stack
Components 27
Docs
Repository-level documentation and usage guides.
- Guides · Overview and lifecycle documentation for the examples.
README.md - Demo flow · Explains the authentication lifecycle and demo scenarios.
DIALTONE-DEMO.md - Use cases · Collects example integration patterns and intended flows.
USE-CASES.md - Forum script · Standalone script outside the main example architectures.
scripts/forum-post.py
Flask example
Python middleware example around a protected web boundary.
- Flask app · Minimal web boundary with protected routes.
examples/flask-middleware/app.py - Auth layer · Encapsulates StrongDM token verification and scope checks.
examples/flask-middleware/strongdm_auth.py
Go and Next.js examples
Middleware and client bootstrap examples in Go and TypeScript.
- Go server · net/http handlers behind StrongDM-aware middleware.
examples/go-middleware/main.go - Auth middleware · Validates tokens and enforces scopes for Go handlers.
examples/go-middleware/strongdmauth.go - Bootstrap client · Command-line client that demonstrates enroll, activate, and call.
examples/go-middleware/client/main.go - Edge middleware · Interception layer that gates access before routes run.
examples/nextjs-middleware/middleware.ts - Validation lib · Shared StrongDM validation logic for the Next.js app.
examples/nextjs-middleware/lib/strongdm-auth.ts - API routes · Protected route handlers for the app API surface.
examples/nextjs-middleware/app/api/protected/route.ts
Swift app
Full Vapor web application example.
- Auth stack · Models and middleware for StrongDM authentication and web security.
examples/agentkey/Sources/App/Auth/StrongDMAuth.swift - Web controllers · HTML-facing controllers for home, dashboard, profile, and static pages.
examples/agentkey/Sources/App/Controllers/Web/DashboardController.swift - API controllers · Machine-readable endpoints for agents, keys, and verification.
examples/agentkey/Sources/App/Controllers/API/AgentAPIController.swift - Data models · Agents, keys, proofs, and activity log entities.
examples/agentkey/Sources/App/Models/Agent.swift - Views and assets · Leaf templates, static assets, and OpenAPI contract.
examples/agentkey/Resources/Views/home.leaf
Client identity examples
Client-only proof-of-possession and workload identity examples.
- DPoP client · Go, Python, and TypeScript clients that generate proofs of possession.
examples/dpop-client/README.md - SPIFFE client · Go, Python, and TypeScript clients that fetch trust bundles and JWT-SVIDs.
examples/spiffe-client/README.md
RAG pipeline
Distributed retrieval-augmented generation example with orchestrator and MCP services.
- Orchestrator · Coordinates ingest and query flows across the pipeline.
examples/secure-rag-pipeline/orchestrator/graph.py - Shared auth · Common authentication logic reused by MCP services.
examples/secure-rag-pipeline/mcp-servers/shared/auth.py - Docs MCP · Document access service in the secure RAG workflow.
examples/secure-rag-pipeline/mcp-servers/docs-mcp/main.py - Vector MCP · Retrieval service for vector-backed search.
examples/secure-rag-pipeline/mcp-servers/vectordb-mcp/main.py - Ranker MCP · Ranking service used during query refinement.
examples/secure-rag-pipeline/mcp-servers/ranker-mcp/main.py - LLM MCP · Generation service that produces final responses.
examples/secure-rag-pipeline/mcp-servers/llm-mcp/main.py - Compose file · Container orchestration for the distributed RAG example.
examples/secure-rag-pipeline/docker-compose.yml
Other components
- StrongDM ID · Tenant-qualified issuer and validation authority used by all examples.
Connections 31
- StrongDM ID → Auth layer: issues tokens · Flask middleware validates StrongDM-issued credentials.
- StrongDM ID → Auth middleware: issues tokens · Go middleware checks JWTs or introspection against StrongDM ID.
- StrongDM ID → Validation lib: issues tokens · Next.js middleware uses StrongDM validation material.
- StrongDM ID → Auth stack: issues tokens · Swift app authenticates users and agents through StrongDM ID.
- StrongDM ID → DPoP client: binds tokens · DPoP clients create proof-of-possession material for StrongDM ID flows.
- StrongDM ID → SPIFFE client: trust bundle · SPIFFE clients fetch trust data and JWT-SVIDs from StrongDM ID.
- StrongDM ID → Orchestrator: protects services · Pipeline orchestration relies on StrongDM-protected endpoints.
- Guides → Demo flow: documents · Repository guides explain the identity lifecycle.
- Guides → Use cases: documents · Use-case notes show example integration patterns.
- Flask app → Auth layer: uses · Routes are wrapped by StrongDM-aware auth checks.
- Go server → Auth middleware: uses · Handlers are protected by middleware.
- Bootstrap client → Go server: calls · Client demonstrates enroll-activate-call lifecycle.
- Edge middleware → Validation lib: delegates · Edge middleware delegates token validation to shared logic.
- Edge middleware → API routes: gates · Requests are allowed or denied before route execution.
- Auth stack → Web controllers: protects · Web handlers rely on auth middleware and security helpers.
- Auth stack → API controllers: protects · API handlers use the same auth boundary.
- Data models → API controllers: serves · API controllers read and write persistent identity records.
- Views and assets → Web controllers: renders · Leaf templates and assets back the dashboard and public pages.
- Orchestrator → Docs MCP: queries · Orchestrator starts by accessing documents.
- Orchestrator → Vector MCP: retrieves · Retrieval stage queries the vector service.
- Orchestrator → Ranker MCP: ranks · Ranking stage refines candidate results.
- Orchestrator → LLM MCP: generates · Generation stage produces the final answer.
- Shared auth → Docs MCP: secures · Shared auth is reused by each MCP server.
- Shared auth → Vector MCP: secures · Shared auth is reused by each MCP server.
- Shared auth → Ranker MCP: secures · Shared auth is reused by each MCP server.
- Shared auth → LLM MCP: secures · Shared auth is reused by each MCP server.
- Compose file → Orchestrator: wires · Compose brings the orchestrator and services up together.
- Compose file → Docs MCP: wires · Compose brings the orchestrator and services up together.
- Compose file → Vector MCP: wires · Compose brings the orchestrator and services up together.
- Compose file → Ranker MCP: wires · Compose brings the orchestrator and services up together.
- Compose file → LLM MCP: wires · Compose brings the orchestrator and services up together.