How pesu-dev/auth works
PESUAuth is a privacy-preserving API that validates PESU Academy credentials and optionally returns profile data. The main flow validates an incoming request, authenticates against PESU Academy, optionally fetches and parses a profile, and returns the result without storing credentials or personal data. Separate routes provide API documentation, health checks, a repository redirect, and metrics. The graph reflects the supplied excerpts and README; some endpoint wiring and documentation modules were not sampled, so uncertain connections are omitted.
Main entry points: app.py FastAPI Entrypoint · pesu.py PESU Authentication · collector.py Metrics Collector · middleware.py Request Instrumentation
Components 17
API Workflow
- FastAPI Entrypoint
app/app.py - Request Validation
app/models/request.py - Profile Response
app/models/profile.py
PESU Integration
- PESU Authentication
app/pesu.py - Authentication Errors
app/exceptions/authentication.py
Monitoring
- Request Instrumentation
app/metrics/middleware.py - Metrics Collector
app/metrics/collector.py - Metrics Token Guard
app/metrics/auth.py - Metrics Models
app/models/metrics.py - Prometheus Renderer
app/metrics/prometheus.py
API Support
- Health Documentation
app/docs/health.py - Metrics Documentation
app/docs/metrics.py - Authentication Documentation
app/docs/authenticate.py - Repository Redirect
app/docs/readme.py - API Documentation Base
app/docs/base.py
Other components
- API Caller
- PESU Academy
Connections 21
- API Caller → FastAPI Entrypoint: sends request
- FastAPI Entrypoint → Request Validation: validates input
- FastAPI Entrypoint → PESU Authentication: authenticates
- PESU Authentication → PESU Academy: sends login
- PESU Authentication → PESU Academy: fetches profile
- PESU Authentication → Profile Response: builds profile
- PESU Authentication → Authentication Errors: raises errors
- FastAPI Entrypoint → API Caller: returns result
- FastAPI Entrypoint → Request Instrumentation: installs middleware
- Request Instrumentation → Metrics Collector: records traffic
- PESU Authentication → Metrics Collector: records upstream activity
- API Caller → Metrics Token Guard: presents token
- FastAPI Entrypoint → Metrics Token Guard: guards metrics route
- FastAPI Entrypoint → Metrics Collector: exposes metrics
- Metrics Collector → Metrics Models: snapshots counters
- FastAPI Entrypoint → Prometheus Renderer: renders metrics
- FastAPI Entrypoint → Health Documentation: documents health
- FastAPI Entrypoint → Metrics Documentation: documents metrics
- FastAPI Entrypoint → Authentication Documentation: documents authentication
- FastAPI Entrypoint → Repository Redirect: documents redirect
- FastAPI Entrypoint → API Documentation Base: builds API docs