-
Notifications
You must be signed in to change notification settings - Fork 1
Stand: 5. Dezember 2025
Version: 1.0.0
Kategorie: Auth
This document gives a short guide how the JWT validator and AuthMiddleware work in Themis, an example JWKS file, and how to test the middleware with curl/PowerShell.
-
auth::JWTValidatorverifies RS256-signed JWTs against a JWKS endpoint or an injected JWKS. It validates signature (kid -> JWK), and standard claims:exp,nbf,iss,aud. -
AuthMiddlewareusesJWTValidatorto guard HTTP endpoints and expose the parsed claims to downstream handlers.
A minimal JWKS (file: docs/auth/jwks_example.json) looks like:
{
"keys": [
{
"kty": "RSA",
"kid": "example-key-1",
"use": "sig",
"alg": "RS256",
"n": "...base64url modulus...",
"e": "AQAB"
}
]
}Replace n with the base64url-encoded RSA modulus of your public key. e is usually AQAB.
JWT config is provided using JWTValidatorConfig (see include/auth/jwt_validator.h). Example:
-
jwks_url(string): remote JWKS endpoint (optional during tests where JWKS are injected) -
expected_issuer(string) -
expected_audience(string) -
jwks_cache_ttl(seconds) -
clock_skew(seconds)
Example initializer:
JWTValidatorConfig cfg;
cfg.jwks_url = "https://pki.example.com/.well-known/jwks.json";
cfg.expected_issuer = "https://auth.example.com";
cfg.expected_audience = "themis-api";
cfg.jwks_cache_ttl = std::chrono::seconds(300);
cfg.clock_skew = std::chrono::seconds(60);
JWTValidator validator(cfg);- Unit tests
- The repo contains
tests/test_jwt_validator.cppwith unit tests that generate RSA keys on the fly and inject JWKS viasetJWKSForTesting(...). - Build and run only JWT tests:
cmake --build C:\VCC\themis\build --config Release --target themis_tests
C:\VCC\themis\build\Release\themis_tests.exe --gtest_filter=JWTValidatorTest.*- Manual curl test (using a pre-generated JWT and JWKS hosted at
http://localhost:8000/jwks):
- Start an HTTP server to serve
docs/auth/jwks_example.json(for examplepython -m http.server 8000in that directory). - Request to protected endpoint (example):
curl -H "Authorization: Bearer <JWT>" http://localhost:8080/api/protectedIf the token is valid, the middleware forwards the request; otherwise it returns 401.
- The JWKS must include the correct
kidthat matches the JWT header. - Use base64url (no padding) for
nandefields. -
exp/nbfare validated with a configurable clock skew (default 60s in tests).
- Add examples for JWKS rotation and multiple
kidentries. - Add an integration test that runs a small local server and verifies middleware with a real HTTP request.
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/