A high-performance, Rust-powered access control gateway for agent-based systems.
Verifies JWT tokens, enforces scope-based permissions, and logs requests with full traceability.
Built for stealth. Deployed for trust. Hardened for scale.
- ✅ JWT authentication (
HS256) - ✅ Scope-based permission checks
- ✅ Clean error handling (401, 403)
- ✅ Structured JSON responses
- ✅ X-Request-ID support
- ✅ Tracing + logging middleware
- ✅ Dockerized deploy
- ✅ Full test coverage
| Tech | Purpose |
|---|---|
Rust + Axum |
Blazing fast API performance |
jsonwebtoken |
Token validation |
tower-http |
Middleware (Request IDs, Tracing) |
dotenv |
Config + secret management |
tokio |
Async execution |
Docker |
Portable, cloud-ready builds |
agent-token-gateway/
├── src/
│ ├── main.rs # Entrypoint with trace layers
│ ├── config.rs # AppState (env config)
│ ├── errors.rs # Unified error system
│ ├── routes.rs # Route definitions
│ ├── handlers/ # /check-access logic
│ ├── utils/ # JWT decoder + scope enforcer
│ ├── middleware/ # (Optional rate limiter)
│ └── lib.rs # Library export for testing
├── tests/
│ └── core.rs # Token + scope enforcement tests
├── .env # Runtime secrets (JWT_SECRET, etc.)
├── Cargo.toml # Rust dependency manifest
├── Dockerfile # Container build script
└── README.md # You're here
JWT_SECRET=super_secret_gateway_key_123
RUST_LOG=infocargo buildcargo runRuns on:
http://localhost:3000
cargo testYou’ll see:
test test_scope_enforcement_allows_valid_action ... ok
test test_expired_token_claims ... ok
✅ All tests passeddocker build -t agent-token-gateway .docker pull cureprotocols/agent-gateway
docker run -p 3000:3000 --env-file .env cureprotocols/agent-gateway
The gateway will be live at: http://localhost:3000POST /check-access
Content-Type: application/json
{
"token": "<your-jwt>",
"action": "agent:read"
}Response:
{
"allowed": true,
"reason": "Access granted"
}- HS256 key from
.envis required to run - Tokens must contain:
sub,iat,exp,scopes
- All scopes are matched exactly
- ⛔ Rate limiting middleware
- 🔄 JWT key rotation support
- 🧩 Agent plugin system
- 🧠 LLM routing integration
- 🧱 Admin dashboard (Laravel, Nuxt)
A stealth operator.
Signal over noise.
Rust over excuses.
🔥 Powered by precision, trust, and execution.