Skip to content

feat(api): add middleware and auth modules#3

Merged
Goldokpa merged 2 commits into
mainfrom
feature/api-middleware-audit
Mar 28, 2026
Merged

feat(api): add middleware and auth modules#3
Goldokpa merged 2 commits into
mainfrom
feature/api-middleware-audit

Conversation

@Goldokpa
Copy link
Copy Markdown
Member

Summary

  • Add request logging middleware with structured JSON logs and request tracing
  • Add audit log middleware for compliance tracking on sensitive operations
  • Implement API key authentication with organization context

Changes

  • src/climatevision/api/middleware.py: Request logging and audit middleware
  • src/climatevision/api/auth.py: API key authentication handler

Test plan

  • Verify X-Request-ID headers appear in responses
  • Check structured logs include timing and status codes
  • Test API key validation returns 401 for invalid keys
  • Confirm audit events logged for POST/PUT/DELETE operations

Author: Olufemi Taiwo (@femi23)

Generated with Claude Code

femi23 and others added 2 commits March 28, 2026 21:17
Implements structured logging middleware with request tracing
and audit trails for compliance monitoring. Includes:
- RequestLoggingMiddleware: logs all requests with timing
- AuditLogMiddleware: tracks sensitive operations
- X-Request-ID headers for distributed tracing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements secure API key authentication for protected endpoints:
- APIKeyAuth class for key generation and validation
- Secure key hashing using SHA-256
- Organization context extraction for access control
- FastAPI dependencies for required/optional auth
- Comprehensive audit logging for auth events

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Goldokpa Goldokpa merged commit e1a0335 into main Mar 28, 2026
mvanhorn pushed a commit to mvanhorn/ClimateVision that referenced this pull request May 17, 2026
…iddleware-audit

Merging Olufemi's API middleware and auth modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants