How dbis-legal-llms/auth-service works
auth-service is a standalone identity and role-bookkeeping API. Its main workflow registers users, authenticates them, resolves roles across registered applications, and returns RS256 access plus rotating refresh tokens; consuming apps verify access tokens through the published JWKS. Separate account-management and application-registry endpoints support role assignment, superuser administration, and per-user OpenRouter keys. The graph follows the sampled route/service calls; broader endpoint capabilities are retained from the README, while unsampled implementation links are omitted rather than inferred.
Main entry points: user_service.py User service · main.py FastAPI application · auth_routes.py Auth endpoints · user_routes.py User endpoints
Components 20
API and sessions
- FastAPI application
app/main.py - Auth endpoints
app/api/routes/auth_routes.py - User endpoints
app/api/routes/user_routes.py - Application endpoint
app/api/routes/application_routes.py - JWKS endpoint
app/api/routes/jwks_routes.py
Identity and roles
- User service
app/services/user_service.py - User models
app/models/user_models.py - Role resolution
app/services/role_resolution.py - Application registry
app/services/application_service.py - Application models
app/models/application_models.py
Token security
- Refresh sessions
app/services/refresh_token_service.py - JWT and JWKS
app/core/jwt.py - RSA key management
app/core/keys.py - Auth dependencies
app/core/deps.py - Password and secrets
app/core/security.py
Persistence and registry
- MongoDB
app/db/mongo.py - Runtime settings
app/config.py - Username word lists
app/data/func.py
Other components
- API client
- Consuming apps
Connections 38
- API client → FastAPI application: calls API
README.md - FastAPI application → Auth endpoints: mounts routes
app/main.py - FastAPI application → User endpoints: mounts routes
app/main.py - FastAPI application → Application endpoint: mounts routes
app/main.py - FastAPI application → JWKS endpoint: mounts routes
app/main.py - FastAPI application → MongoDB: gets database
app/main.py - FastAPI application → Refresh sessions: ensures indexes
app/main.py - Auth endpoints → User service: registers and verifies
app/api/routes/auth_routes.py - Auth endpoints → Application registry: loads registered apps
app/api/routes/auth_routes.py - Auth endpoints → Role resolution: resolves token roles
app/api/routes/auth_routes.py - Auth endpoints → Refresh sessions: starts and rotates
app/api/routes/auth_routes.py - Auth endpoints → JWT and JWKS: mints access token
app/api/routes/auth_routes.py - Auth endpoints → User models: accepts user input
app/api/routes/auth_routes.py - User endpoints → User service: manages accounts
app/api/routes/user_routes.py - User endpoints → Application registry: loads app roles
app/api/routes/user_routes.py - User endpoints → Role resolution: checks app admin
app/api/routes/user_routes.py - User endpoints → Refresh sessions: revokes sessions
app/api/routes/user_routes.py - User endpoints → Password and secrets: reauthenticates password
app/api/routes/user_routes.py - Application endpoint → Application registry: lists applications
app/api/routes/application_routes.py - JWKS endpoint → JWT and JWKS: serializes public keys
app/api/routes/jwks_routes.py - Consuming apps → JWKS endpoint: fetches signing keys
README.md - Consuming apps → JWT and JWKS: verifies access tokens
README.md - JWT and JWKS → RSA key management: gets signing keys
app/core/jwt.py - Auth dependencies → JWT and JWKS: verifies bearer token
app/core/deps.py - Auth dependencies → User service: loads current user
app/core/deps.py - Auth dependencies → MongoDB: gets database
app/core/deps.py - User service → MongoDB: reads and writes users
app/services/user_service.py - User service → Password and secrets: hashes and verifies passwords
app/services/user_service.py - User service → Username word lists: uses word lists
app/services/user_service.py - User service → User models: creates user records
app/services/user_service.py - User service → Application models: uses app records
app/services/user_service.py - User service → Password and secrets: encrypts API keys
app/services/user_service.py - Application registry → MongoDB: reads and writes registry
app/services/application_service.py - Application registry → Application models: validates registry data
app/services/application_service.py - Refresh sessions → MongoDB: stores token hashes
app/services/refresh_token_service.py - Refresh sessions → Runtime settings: reads token lifetime
app/services/refresh_token_service.py - RSA key management → Runtime settings: reads key location
app/core/keys.py - MongoDB → Runtime settings: reads connection settings
app/db/mongo.py