swiftpy-framework 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/.env.example +3 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/CHANGELOG.md +19 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/PKG-INFO +2 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/README.md +1 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/auth.py +2 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-14-installation-quick-start.md +4 -4
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-authentication-and-security.md +25 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/pyproject.toml +1 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/auth_manager.py +69 -68
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/jwt_guard.py +5 -5
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/jwt_issuer.py +52 -9
- swiftpy_framework-0.2.1/swiftpy/auth/user_context.py +348 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/new.py +5 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/application.py +51 -1
- swiftpy_framework-0.2.1/tests/auth/test_auth_context_on_issue.py +317 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_auth_proxy.py +153 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_refresh_and_logout.py +1 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_phase9_cli_remediation.py +1 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/uv.lock +1 -1
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/.dockerignore +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/.github/workflows/ci.yml +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/.github/workflows/publish.yml +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/.gitignore +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/CONTRIBUTING.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/Dockerfile +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/LICENSE +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/events/user_registered.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/handler/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/middleware/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/middleware/admin_middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/middleware/auth_middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/middleware/test_middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/http/requests/create_user_request.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/jobs/send_notification_job.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/listeners/send_welcome_notification.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/mail/welcome_email.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/models/user.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/app_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/auth_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/cache_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/database_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/event_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/filesystem_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/mail_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/providers/queue_service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/repositories/user_repository.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/schemas/user_schema.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/app/services/user_service.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/bootstrap/cache/.gitkeep +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/ai.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/app.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/cache.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/cors.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/database.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/events.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/filesystems.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/logging.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/mail.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/config/queue.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/database/migrations/2026_01_01_000000_create_users_table.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/database/seeders/database_seeder.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/docker-compose.yml +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-ai-subsystem.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-cache-events-and-queues.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-core-application-di-and-config.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-database-query-builder-and-migrations.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-filesystem-storage-and-mail.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-http-routing-middleware-and-exceptions.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-orm-models-and-relationships.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-validation-and-form-requests.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-15-websockets-and-admin.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-19-application-schemas.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-19-cli-and-testing.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-19-database-schema-and-blueprint.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-20-error-handling.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-20-logging.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/documentations/2026-11-20-request-and-responses.md +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/main.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/red-black.png +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/routes/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/routes/api.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/.gitignore +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/admin/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/admin/auth.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/admin/registry.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/admin/views.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/_deterministic.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/_fake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/agents/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/agents/base_agent.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/agents/memory.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/client.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/conversation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/embeddings.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/history_strategies.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/observability/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/observability/drivers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/observability/observer.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/pool.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/pricing.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/prompts/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/prompts/loader.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/providers/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/providers/anthropic_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/providers/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/providers/openai_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/context_formatter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/pipeline_builder.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/reranker.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/result.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/rag/retriever.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/redis_store.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/streaming.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/tools/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/tools/base_tool.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/tools/first_party.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/tools/tool_loop.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/chroma_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/in_memory_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/lancedb_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/pgvector_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/pinecone_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/ai/vectorstore/qdrant_adapter.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/api_key_guard.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth/token_blacklist.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/auth_manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/cache/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/cache/cache.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/cache/driver.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/cache/drivers/memory.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/cache/drivers/redis.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/cli.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/cache.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/make.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/migrate.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/queue.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/seed.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/start.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/commands/storage.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/loader.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/controller.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/event.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/job.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/listener.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/mail.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/middleware.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.alter.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.api_keys.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.blank.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.create.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/migration.update.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/model.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/provider.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/repository.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/request.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/resource.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/schema.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/seeder.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/console/stubs/service.stub +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/bootstrap.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/container.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/container_exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/context.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/core/providers/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/identifiers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/blueprint.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/lock.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/migration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/migrator.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/migrations/schema.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/orm/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/orm/fields.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/orm/model.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/orm/registry.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/orm/relationships.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/pagination/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/pagination/contracts.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/pagination/paginator.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/pagination/simple_paginator.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/pool.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/query_builder.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/seeder.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/database/transaction.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/events/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/events/dispatcher.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/events/redis_bus.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/disk.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/drivers/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/drivers/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/drivers/local.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/drivers/s3.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/events.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/metadata.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/paths.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/uploads/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/uploads/handlers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/uploads/uploaded_file.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/uploads/validators.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/filesystem/visibility.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/helpers/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/helpers/helper.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/http/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/http/middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/http/request.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/http/response.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/http/router.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/logging/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/logging/channels.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/logging/log.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/logging/manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/attachments.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/envelope.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/facade.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/mailable.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/message.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/models.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/queue/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/queue/job.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/service_provider.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/templates/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/templates/renderer.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/api/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/api/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/api/mailgun.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/api/resend.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/api/sendgrid.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/base.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/console.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/sendmail.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/mail/transports/smtp.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/queue/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/queue/dispatcher.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/queue/job.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/queue/worker.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/support/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/support/hashing.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/support/keys.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/support/redis_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/support/strings.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/fakes/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/fakes/ai_fake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/fakes/vectorstore_fake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/fixtures.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/http_client.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/testing/test_case.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/form_request.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/protocols.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/builtin.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/exists.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/registry.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/required.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/rules/unique.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/validation/validator.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/websockets/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/websockets/connection.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/swiftpy/websockets/manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/admin/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/admin/test_admin.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/conftest.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/test_chroma.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/test_lancedb.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/test_pinecone.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/test_qdrant.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/integration/test_rag_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_agents.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_ai_fake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_ai_fake_isolation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_client.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_conversation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_embeddings.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_middleware.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_middleware_concurrency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_observability.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_observability_resilience.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_phase7_ai_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_phase8_agents_tools_prompts_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_phase8_rag_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_phase8_vectorstore_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_prompts.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_prompts_security.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_providers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_rag.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_streaming.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_tools.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_vectorstore.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/ai/test_vectorstore_adapters.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/app/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/app/test_application_providers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/app/test_starter_auth.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_api_key_guard.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_auth_manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_auth_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_auth_security.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_jwt_issuer.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_password_hashing.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/auth/test_token_blacklist.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/benchmarks.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/test_cache_concurrency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/test_cache_manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/test_driver_correctness.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/test_memory_cache.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/cache/test_redis_cache.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/concurrency/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/concurrency/test_circular_dependency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/concurrency/test_container_semantics.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/concurrency/test_resolution.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/concurrency/test_resolution2.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/conftest.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_cache_commands.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_cli.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_new_command.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_start.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_storage_command.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/console/test_stubs_and_make.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/test_application_config_isolation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/test_core_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/test_exceptions.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/test_instance_singletons.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/core/test_lifespan.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_orm_expansion.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_orm_vector.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_pagination_and_grouping.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_pagination_pg_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_pgvector_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_phase4_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_query_expansion.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_query_expansion_pg_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_seeder.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/database/test_sequence_gaps.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/load_test_database.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/load_test_database2.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_arbitrary_primary_keys.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_identifiers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_mass_writes.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_pool_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_query_builder_terminals.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_sql_injections.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/db/test_transaction_isolation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/docs/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/docs/test_readme_examples.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/e2e/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/e2e/test_concurrent_auth.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/e2e/test_crud_auth_e2e.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/events/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/events/test_event_dispatcher.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/events/test_model_events.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/events/test_redis_bus.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/events/test_redis_bus_reliability.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_cli_storage_link.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_disk.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_filesystem_concurrency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_filesystem_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_http_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_local_driver.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_multipart.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_paths.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_phase6_filesystem_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_s3_driver.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_signed_urls.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_storage_facade.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_uploaded_file.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/filesystem/test_validation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_error_pipeline.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_http_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_include_router.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_request.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_request_router_abort.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_response.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_route_groups.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/http/test_router.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/integration/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/integration/test_queue_event_websocket.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/logging/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/logging/test_logging.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_api_transports.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_attachments.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_cli_make_mail.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_console_transport.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_envelope.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_facade_and_fake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_mailable.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_manager_and_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_message.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_phase6_mail_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_queue_integration.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_service_provider_and_helpers.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_smtp_and_sendmail.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/mail/test_templates.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/migrations/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/migrations/test_migrations.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_defaults_dirty.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_eager_loading.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_hidden.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_mass_assignment.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_model_events_transaction.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/orm/test_relationships_hardening.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_after_commit.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_phase5_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_poison_messages.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_queue.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_reliability.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_signing.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/queue/test_worker_behavior.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/security/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/security/test_security_audit.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/stress/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/stress/test_context_isolation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/support/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/support/test_redis_config.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/support/test_strings.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/testing/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/testing/test_fixtures.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/testing/test_phase9_testing_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/testing/test_test_client.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/typing/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/typing/test_orm_typing.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_db_rules.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_form_request_fail_closed.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_form_request_pipeline.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_phase6_validation_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_rules_hardening.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_validation_concurrency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_validation_ergonomics.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/validation/test_validator_rules.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/__init__.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_broadcast.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_handshake.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_lifecycle.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_websocket_concurrency.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_websocket_connection.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_websocket_manager.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_websocket_remediation.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/tests/websockets/test_websocket_routing_and_lifecycle.py +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/views/admin/dashboard.html +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/views/admin/login.html +0 -0
- {swiftpy_framework-0.2.0 → swiftpy_framework-0.2.1}/views/mail/template.html +0 -0
|
@@ -4,6 +4,25 @@ All notable changes to SwiftPY will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.2.1] - 2026-11-20
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **`CurrentUser` and `auth()` after an access token is issued (`swiftpy.auth`):** `JWTIssuer.issue_token(token_type="access")`, `issue_access_token()`, `issue_token_pair()` and `refresh_token_pair()` now bind the user into the request `Context` and `request.state`, so an already-injected `CurrentUser` and `auth().check()` / `id()` / `user()` work immediately (for example inside `/login` or `/refresh`). Refresh tokens never bind a user, and issuing a token for a different subject never replaces an already-authenticated user.
|
|
11
|
+
- `FrameworkServiceProvider` now registers `CurrentUser` as a scoped binding, so injecting `CurrentUser` works with `auto_discover_providers=False`.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `JWTIssuer` token methods accept a saved `Model`, a mapping with `id`/`sub`, or a plain id as `subject`, plus an optional `user=` keyword (`Model` or mapping). A `user=` that does not match the subject, or a model without a primary key, raises `ValueError`. Sensitive keys and `__hidden__` fields are never bound.
|
|
15
|
+
- Opt-in `auth.hydrate_user` (`AUTH_HYDRATE_USER`, default `false`): `require_jwt()` / `JWTGuard` load the User model by `sub` (one query per request, degrading to token claims with a warning on database errors) so sub-only tokens expose every non-hidden field.
|
|
16
|
+
- Opt-in `auth.passive_resolution` (`AUTH_PASSIVE_RESOLUTION`, default `false`): routes without a guard resolve a valid Bearer access token into `CurrentUser` / `auth()` when the default guard is `jwt`. Revoked, expired or invalid tokens stay guests.
|
|
17
|
+
- New internal module `swiftpy.auth.user_context` shared by `JWTIssuer`, `require_jwt()` and `AuthManager`; `resolve_user_model_class` is still exported from `swiftpy.auth`, `swiftpy.auth.auth_manager` and `swiftpy.auth_manager`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- `require_jwt()` now returns the bound user dictionary (token claims plus model fields when hydrated) instead of the raw claims dictionary.
|
|
21
|
+
- Generated projects (`swiftpy new`) include `hydrate_user` / `passive_resolution` in `config/auth.py`, matching `.env` keys, and depend on `swiftpy-framework>=0.2.1`.
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
- Updated [`documentations/2026-11-15-authentication-and-security.md`](documentations/2026-11-15-authentication-and-security.md) with issuing-time context binding, `hydrate_user`, `passive_resolution`, and the `CurrentUser.id` vs `auth().id()` typing note.
|
|
25
|
+
|
|
7
26
|
## [0.2.0] - 2026-11-19
|
|
8
27
|
|
|
9
28
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: swiftpy-framework
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: SwiftPY is a new generation async-first Python framework purpose built for the modern API and AI economy.
|
|
5
5
|
Project-URL: Homepage, https://github.com/obrainwave/swiftpy
|
|
6
6
|
Project-URL: Repository, https://github.com/obrainwave/swiftpy
|
|
@@ -89,6 +89,7 @@ All core architectural, storage, AI, and security hardening phases have been com
|
|
|
89
89
|
| **Week 26: Security Audit & Hardening** | SQL injection audit, JWT & bcrypt API keys, JSON depth & streaming limits, traceback suppression | ✅ Completed |
|
|
90
90
|
| **Week 26: Pagination & Aggregation Subsystem** | Limit/offset parameterized SQL, length-aware `paginate()`, `simple_paginate()`, `group_by()` & `having()` | ✅ Completed |
|
|
91
91
|
| **Release v0.2.0: DX, Logging, Auth Refresh & Docs** | `ValidatedData` & `validate(request)`, `Request.input()` & `abort()`, `Router(prefix, middleware)`, `Blueprint.enum`/`medium_text`/`long_text`, `swiftpy.logging` (`Log`), `refresh_token_pair()` & `auth().logout()`, 17 user guides in `documentations/` | ✅ Completed |
|
|
92
|
+
| **Release v0.2.1: Auth Context on Token Issue** | `CurrentUser` / `auth()` available when an access token is issued, `user=` / `Model` subjects, opt-in `auth.hydrate_user` & `auth.passive_resolution` | ✅ Completed |
|
|
92
93
|
|
|
93
94
|
*See [`documentations/2026-11-14-installation-quick-start.md`](./documentations/2026-11-14-installation-quick-start.md) for the complete step-by-step documentation series and [`CHANGELOG.md`](./CHANGELOG.md) for release notes.*
|
|
94
95
|
|
|
@@ -59,6 +59,7 @@ All core architectural, storage, AI, and security hardening phases have been com
|
|
|
59
59
|
| **Week 26: Security Audit & Hardening** | SQL injection audit, JWT & bcrypt API keys, JSON depth & streaming limits, traceback suppression | ✅ Completed |
|
|
60
60
|
| **Week 26: Pagination & Aggregation Subsystem** | Limit/offset parameterized SQL, length-aware `paginate()`, `simple_paginate()`, `group_by()` & `having()` | ✅ Completed |
|
|
61
61
|
| **Release v0.2.0: DX, Logging, Auth Refresh & Docs** | `ValidatedData` & `validate(request)`, `Request.input()` & `abort()`, `Router(prefix, middleware)`, `Blueprint.enum`/`medium_text`/`long_text`, `swiftpy.logging` (`Log`), `refresh_token_pair()` & `auth().logout()`, 17 user guides in `documentations/` | ✅ Completed |
|
|
62
|
+
| **Release v0.2.1: Auth Context on Token Issue** | `CurrentUser` / `auth()` available when an access token is issued, `user=` / `Model` subjects, opt-in `auth.hydrate_user` & `auth.passive_resolution` | ✅ Completed |
|
|
62
63
|
|
|
63
64
|
*See [`documentations/2026-11-14-installation-quick-start.md`](./documentations/2026-11-14-installation-quick-start.md) for the complete step-by-step documentation series and [`CHANGELOG.md`](./CHANGELOG.md) for release notes.*
|
|
64
65
|
|
|
@@ -2,6 +2,8 @@ from swiftpy.helpers.helper import env, env_bool
|
|
|
2
2
|
|
|
3
3
|
CONFIG: dict[str, object] = {
|
|
4
4
|
"blacklist_enabled": env_bool("AUTH_BLACKLIST_ENABLED", True),
|
|
5
|
+
"hydrate_user": env_bool("AUTH_HYDRATE_USER", False),
|
|
6
|
+
"passive_resolution": env_bool("AUTH_PASSIVE_RESOLUTION", False),
|
|
5
7
|
"defaults": {
|
|
6
8
|
"guard": env("AUTH_GUARD", "jwt"),
|
|
7
9
|
},
|
|
@@ -159,7 +159,7 @@ my_api/
|
|
|
159
159
|
├── docker-compose.yml # name: my_api; app, postgres (pgvector:pg16), & redis services
|
|
160
160
|
├── Dockerfile
|
|
161
161
|
├── main.py # Entrypoint: GET /, /api router, register_exception_handlers(app)
|
|
162
|
-
└── pyproject.toml # Configured with swiftpy-framework>=0.2.
|
|
162
|
+
└── pyproject.toml # Configured with swiftpy-framework>=0.2.1, setuptools, & mypy strict settings
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
What `swiftpy new my_api` configures automatically:
|
|
@@ -313,7 +313,7 @@ The scaffolded `Dockerfile` reads `[project].dependencies` from your project's `
|
|
|
313
313
|
name = "my_api"
|
|
314
314
|
version = "0.1.0"
|
|
315
315
|
dependencies = [
|
|
316
|
-
"swiftpy-framework>=0.2.
|
|
316
|
+
"swiftpy-framework>=0.2.1",
|
|
317
317
|
# ...
|
|
318
318
|
]
|
|
319
319
|
```
|
|
@@ -325,7 +325,7 @@ The scaffolded `Dockerfile` reads `[project].dependencies` from your project's `
|
|
|
325
325
|
docker compose exec app swiftpy --version
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
- If you did **not** edit `pyproject.toml` (for example, keeping `swiftpy-framework>=0.1.6` to pull a newly published `0.2.
|
|
328
|
+
- If you did **not** edit `pyproject.toml` (for example, keeping `swiftpy-framework>=0.1.6` to pull a newly published `0.2.1` release from PyPI), Docker's `COPY pyproject.toml .` layer stays cached unless you force a rebuild:
|
|
329
329
|
|
|
330
330
|
```bash
|
|
331
331
|
docker compose build --no-cache app
|
|
@@ -343,7 +343,7 @@ If running without Docker, upgrade inside your activated `.venv`:
|
|
|
343
343
|
uv sync --upgrade-package swiftpy-framework
|
|
344
344
|
|
|
345
345
|
# Or with pip
|
|
346
|
-
python -m pip install --upgrade "swiftpy-framework>=0.2.
|
|
346
|
+
python -m pip install --upgrade "swiftpy-framework>=0.2.1"
|
|
347
347
|
swiftpy --version
|
|
348
348
|
```
|
|
349
349
|
|
|
@@ -79,6 +79,10 @@ swiftpy make:service AuthService
|
|
|
79
79
|
APP_KEY=base64:<32-byte-base64-key>
|
|
80
80
|
AUTH_GUARD=jwt
|
|
81
81
|
AUTH_BLACKLIST_ENABLED=true
|
|
82
|
+
# Opt-in (default false): load the User model by `sub` on verified tokens (one query per request)
|
|
83
|
+
AUTH_HYDRATE_USER=false
|
|
84
|
+
# Opt-in (default false): resolve a valid Bearer token on routes without JWTGuard
|
|
85
|
+
AUTH_PASSIVE_RESOLUTION=false
|
|
82
86
|
BCRYPT_ROUNDS=12
|
|
83
87
|
|
|
84
88
|
# JWT (HS256 requires at least 32 UTF-8 bytes)
|
|
@@ -185,6 +189,9 @@ Important `JWTIssuer` rules:
|
|
|
185
189
|
|
|
186
190
|
- **Reserved claims cannot be overridden:** Passing `sub`, `iat`, `exp`, `jti`, `type`, `token_type`, `typ`, `iss`, `aud`, or `nbf` inside `claims` raises `ValueError`.
|
|
187
191
|
- **Isolated refresh claims:** `issue_token_pair()` attaches `claims` to the access token **only**; pass `refresh_claims={...}` if you explicitly want custom claims on the refresh token.
|
|
192
|
+
- **`CurrentUser` and `auth()` are available as soon as an access token is issued:** `issue_token()`, `issue_access_token()`, `issue_token_pair()` and `await refresh_token_pair()` bind the user into the request `Context`, so an already-injected `CurrentUser` and `auth().check()` / `auth().id()` / `auth().user()` work in the same request (for example inside `/login`). Refresh tokens never bind a user.
|
|
193
|
+
- **What gets bound:** pass the subject as `user.id`, a saved `Model` instance, or a mapping with an `id`/`sub` key. Pass `user=` (a `Model` or mapping) to attach more fields to a plain id. Sensitive keys (`password`, `password_hash`, `key_hash`, `secret`, `token`) and `__hidden__` model fields are never bound. A `user=` whose id does not match the subject raises `ValueError`, and a model without a primary key cannot be used as a subject.
|
|
194
|
+
- **Existing sessions win:** issuing a token for a *different* subject while another user is authenticated (for example an admin minting a token) leaves the authenticated user untouched.
|
|
188
195
|
- **Strict algorithm enforcement:** `alg="none"` (in any case) and algorithm mismatches (`"hs256"`, HS256 token submitted to an RS256 verifier) raise `InvalidAlgorithmError`.
|
|
189
196
|
|
|
190
197
|
### 3. Complete Login Endpoint & Service Example
|
|
@@ -272,6 +279,24 @@ def admin_routes(group: RouteGroup) -> None:
|
|
|
272
279
|
return json_response({"admin_id": user.id})
|
|
273
280
|
```
|
|
274
281
|
|
|
282
|
+
```python
|
|
283
|
+
@router.post("/auth/login")
|
|
284
|
+
async def login(payload: LoginRequest, jwt: JWTIssuer, current: CurrentUser) -> Response:
|
|
285
|
+
user = await authenticate(payload) # your own lookup/password check
|
|
286
|
+
tokens = jwt.issue_token_pair(user) # or jwt.issue_token_pair(user.id, user=user)
|
|
287
|
+
|
|
288
|
+
# Available immediately, without waiting for the next request:
|
|
289
|
+
assert auth().check() and auth().id() == user.id
|
|
290
|
+
assert current.is_authenticated and current.email == user.email
|
|
291
|
+
return json_response(tokens)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Tokens that carry only `sub`.** `require_jwt()` / `JWTGuard` bind the verified claims. Set `AUTH_HYDRATE_USER=true` (`auth.hydrate_user`) and, when a `DatabasePool` is initialized, they also load the User model by primary key so `CurrentUser` and `auth().user()` expose every non-hidden field. This costs one query per authenticated request and is off by default; if the lookup fails the request continues with the token claims and a warning is logged. `require_jwt()` returns the bound user dictionary (token claims plus model fields) rather than the raw claims.
|
|
295
|
+
|
|
296
|
+
**Routes without `JWTGuard`.** By default only guards authenticate. Set `AUTH_PASSIVE_RESOLUTION=true` (`auth.passive_resolution`, default guard `jwt`) to let routes without a guard resolve a valid `Authorization: Bearer <access_token>` into `CurrentUser` / `auth()`. Invalid, expired or revoked tokens are ignored and the request stays a guest; use `JWTGuard` when you need a `401`.
|
|
297
|
+
|
|
298
|
+
> `CurrentUser.id` returns the raw token `sub` (a string) when no model is bound, while `auth().id()` coerces it to the User model's primary key type. Compare with `str(...)` or use `auth().id()` consistently.
|
|
299
|
+
|
|
275
300
|
For token refresh endpoints, use `await jwt.refresh_token_pair(refresh_token)` rather than calling `issue_token_pair()` manually. It verifies the incoming token with `expected_type="refresh"`, checks `TokenBlacklist`, revokes the previous refresh token's `jti` automatically (`rotate=True` by default) so reused refresh tokens fail with `TokenRevokedError` (`401`), and issues a fresh access/refresh pair:
|
|
276
301
|
|
|
277
302
|
```python
|
|
@@ -10,7 +10,7 @@ dev = [
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "swiftpy-framework"
|
|
13
|
-
version = "0.2.
|
|
13
|
+
version = "0.2.1"
|
|
14
14
|
description = "SwiftPY is a new generation async-first Python framework purpose built for the modern API and AI economy."
|
|
15
15
|
requires-python = ">=3.12"
|
|
16
16
|
dependencies = [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
|
-
import importlib
|
|
5
4
|
import inspect
|
|
6
5
|
import logging
|
|
7
6
|
import math
|
|
@@ -19,27 +18,28 @@ from swiftpy.auth.exceptions import (
|
|
|
19
18
|
from swiftpy.auth.jwt_guard import JWTGuard
|
|
20
19
|
from swiftpy.auth.jwt_issuer import JWTIssuer
|
|
21
20
|
from swiftpy.auth.token_blacklist import TokenBlacklist, is_token_blacklist_enabled
|
|
21
|
+
from swiftpy.auth.user_context import (
|
|
22
|
+
CONTEXT_AUTH_GUARD_KEY,
|
|
23
|
+
CONTEXT_LOGGED_OUT_KEY,
|
|
24
|
+
CONTEXT_USER_KEY,
|
|
25
|
+
CONTEXT_USER_MODEL_KEY,
|
|
26
|
+
SENSITIVE_USER_KEYS,
|
|
27
|
+
resolve_user_model_class,
|
|
28
|
+
)
|
|
22
29
|
from swiftpy.core.config import Config
|
|
23
30
|
from swiftpy.core.container import Container, get_container
|
|
24
31
|
from swiftpy.core.context import Context
|
|
25
32
|
from swiftpy.database.orm.model import Model
|
|
26
|
-
from swiftpy.database.orm.registry import _MODEL_REGISTRY
|
|
27
33
|
from swiftpy.database.pool import DatabasePool
|
|
28
34
|
from swiftpy.http.request import Request
|
|
29
35
|
|
|
30
36
|
logger = logging.getLogger("swiftpy.auth.manager")
|
|
31
37
|
|
|
32
|
-
_CONTEXT_USER_KEY =
|
|
33
|
-
_CONTEXT_USER_MODEL_KEY =
|
|
34
|
-
_CONTEXT_AUTH_GUARD_KEY =
|
|
38
|
+
_CONTEXT_USER_KEY = CONTEXT_USER_KEY
|
|
39
|
+
_CONTEXT_USER_MODEL_KEY = CONTEXT_USER_MODEL_KEY
|
|
40
|
+
_CONTEXT_AUTH_GUARD_KEY = CONTEXT_AUTH_GUARD_KEY
|
|
35
41
|
|
|
36
|
-
_SENSITIVE_KEYS: frozenset[str] =
|
|
37
|
-
"password",
|
|
38
|
-
"password_hash",
|
|
39
|
-
"key_hash",
|
|
40
|
-
"secret",
|
|
41
|
-
"token",
|
|
42
|
-
})
|
|
42
|
+
_SENSITIVE_KEYS: frozenset[str] = SENSITIVE_USER_KEYS
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class AuthUser(dict[str, Any]):
|
|
@@ -102,61 +102,28 @@ class AuthUser(dict[str, Any]):
|
|
|
102
102
|
return f"AuthUser({super().__repr__()})"
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
def
|
|
105
|
+
def _adopt_request_state_user() -> Any:
|
|
106
106
|
"""
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
1. Container Config for 'auth.model', 'auth.user_model', or 'auth.providers.users.model'.
|
|
111
|
-
2. Global _MODEL_REGISTRY for a model named 'User' or ending with 'User'.
|
|
112
|
-
3. Import fallback for 'app.models.user.User'.
|
|
107
|
+
Adopt a user already stored in `request.state` (for example by a guard that ran in a
|
|
108
|
+
different task) into `Context`. Never decodes credentials: authentication stays with
|
|
109
|
+
guards (`JWTGuard`, `require_jwt`), which also enforce token revocation.
|
|
113
110
|
"""
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if isinstance(target, type) and issubclass(target, Model):
|
|
131
|
-
return target
|
|
132
|
-
elif model_setting in _MODEL_REGISTRY:
|
|
133
|
-
variants = _MODEL_REGISTRY[model_setting]
|
|
134
|
-
if variants:
|
|
135
|
-
return next(iter(variants.values()))
|
|
136
|
-
except (RuntimeError, KeyError, AttributeError, ImportError, ValueError):
|
|
137
|
-
pass
|
|
138
|
-
|
|
139
|
-
if "User" in _MODEL_REGISTRY:
|
|
140
|
-
candidates = _MODEL_REGISTRY["User"]
|
|
141
|
-
if candidates:
|
|
142
|
-
for qname, cls in candidates.items():
|
|
143
|
-
if "app.models" in qname:
|
|
144
|
-
return cls
|
|
145
|
-
return next(iter(candidates.values()))
|
|
146
|
-
|
|
147
|
-
for model_name, candidates in _MODEL_REGISTRY.items():
|
|
148
|
-
if model_name.lower().endswith("user") and candidates:
|
|
149
|
-
return next(iter(candidates.values()))
|
|
150
|
-
|
|
151
|
-
try:
|
|
152
|
-
mod = importlib.import_module("app.models.user")
|
|
153
|
-
target = getattr(mod, "User", None)
|
|
154
|
-
if isinstance(target, type) and issubclass(target, Model):
|
|
155
|
-
return target
|
|
156
|
-
except (ImportError, AttributeError):
|
|
157
|
-
pass
|
|
158
|
-
|
|
159
|
-
return None
|
|
111
|
+
existing = Context.get(_CONTEXT_USER_KEY)
|
|
112
|
+
if existing is not None or Context.get(CONTEXT_LOGGED_OUT_KEY):
|
|
113
|
+
return existing
|
|
114
|
+
|
|
115
|
+
req = Context.get("request")
|
|
116
|
+
if not isinstance(req, Request) or not isinstance(req.state, dict):
|
|
117
|
+
return None
|
|
118
|
+
if req.state.get(CONTEXT_LOGGED_OUT_KEY):
|
|
119
|
+
return None
|
|
120
|
+
state_user = req.state.get("user")
|
|
121
|
+
if state_user is None:
|
|
122
|
+
return None
|
|
123
|
+
Context.set(_CONTEXT_USER_KEY, state_user)
|
|
124
|
+
if "auth_guard" in req.state:
|
|
125
|
+
Context.set(_CONTEXT_AUTH_GUARD_KEY, req.state["auth_guard"])
|
|
126
|
+
return state_user
|
|
160
127
|
|
|
161
128
|
|
|
162
129
|
def _build_auth_user_from_dict(raw: dict[str, Any]) -> AuthUser:
|
|
@@ -227,6 +194,12 @@ def _build_auth_user_from_model(model: Any) -> AuthUser:
|
|
|
227
194
|
if f not in hidden_fields and f not in data:
|
|
228
195
|
data[f] = getattr(model, f, None)
|
|
229
196
|
|
|
197
|
+
ctx_payload = Context.get(_CONTEXT_USER_KEY)
|
|
198
|
+
if isinstance(ctx_payload, dict):
|
|
199
|
+
for k, v in ctx_payload.items():
|
|
200
|
+
if k not in hidden_fields and k not in _SENSITIVE_KEYS and k not in data:
|
|
201
|
+
data[k] = v
|
|
202
|
+
|
|
230
203
|
return AuthUser(data, model=model_inst)
|
|
231
204
|
|
|
232
205
|
|
|
@@ -237,13 +210,25 @@ def set_user_model(model: Any, guard: str | None = None) -> None:
|
|
|
237
210
|
Call this from your authentication middleware after fetching the user from the
|
|
238
211
|
database. ``auth().user()`` reads from this key.
|
|
239
212
|
"""
|
|
213
|
+
Context.set(CONTEXT_LOGGED_OUT_KEY, False)
|
|
240
214
|
Context.set(_CONTEXT_USER_MODEL_KEY, model)
|
|
241
215
|
if guard is not None:
|
|
242
216
|
Context.set(_CONTEXT_AUTH_GUARD_KEY, guard)
|
|
217
|
+
user_dict: dict[str, Any] | None = None
|
|
243
218
|
if hasattr(model, "to_dict") and callable(model.to_dict):
|
|
244
|
-
|
|
219
|
+
user_dict = model.to_dict()
|
|
220
|
+
Context.set(_CONTEXT_USER_KEY, user_dict)
|
|
245
221
|
elif isinstance(model, dict):
|
|
246
|
-
|
|
222
|
+
user_dict = model
|
|
223
|
+
Context.set(_CONTEXT_USER_KEY, user_dict)
|
|
224
|
+
|
|
225
|
+
req = Context.get("request")
|
|
226
|
+
if isinstance(req, Request) and isinstance(req.state, dict):
|
|
227
|
+
req.state.pop(CONTEXT_LOGGED_OUT_KEY, None)
|
|
228
|
+
if user_dict is not None:
|
|
229
|
+
req.state["user"] = user_dict
|
|
230
|
+
if guard is not None:
|
|
231
|
+
req.state["auth_guard"] = guard
|
|
247
232
|
|
|
248
233
|
|
|
249
234
|
def current_user_model() -> Any | None:
|
|
@@ -251,6 +236,10 @@ def current_user_model() -> Any | None:
|
|
|
251
236
|
Retrieve the authenticated ORM Model instance for the current request task.
|
|
252
237
|
Returns None if no model has been stored via set_user_model().
|
|
253
238
|
"""
|
|
239
|
+
model = Context.get(_CONTEXT_USER_MODEL_KEY)
|
|
240
|
+
if model is not None:
|
|
241
|
+
return model
|
|
242
|
+
_adopt_request_state_user()
|
|
254
243
|
return Context.get(_CONTEXT_USER_MODEL_KEY)
|
|
255
244
|
|
|
256
245
|
|
|
@@ -273,6 +262,9 @@ class AuthProxy:
|
|
|
273
262
|
with all `__hidden__` fields excluded. Returns `None` if unauthenticated
|
|
274
263
|
or if the active guard does not match the requested guard.
|
|
275
264
|
"""
|
|
265
|
+
if Context.get(_CONTEXT_USER_KEY) is None and Context.get(_CONTEXT_USER_MODEL_KEY) is None:
|
|
266
|
+
_adopt_request_state_user()
|
|
267
|
+
|
|
276
268
|
if self._guard is not None:
|
|
277
269
|
active_guard = Context.get(_CONTEXT_AUTH_GUARD_KEY)
|
|
278
270
|
if active_guard is None:
|
|
@@ -371,6 +363,7 @@ class AuthProxy:
|
|
|
371
363
|
|
|
372
364
|
@staticmethod
|
|
373
365
|
def _clear_auth_context(request: Request | None = None) -> None:
|
|
366
|
+
Context.set(CONTEXT_LOGGED_OUT_KEY, True)
|
|
374
367
|
Context.set(_CONTEXT_USER_KEY, None)
|
|
375
368
|
Context.set(_CONTEXT_USER_MODEL_KEY, None)
|
|
376
369
|
Context.set(_CONTEXT_AUTH_GUARD_KEY, None)
|
|
@@ -378,6 +371,7 @@ class AuthProxy:
|
|
|
378
371
|
if isinstance(req, Request) and hasattr(req, "state"):
|
|
379
372
|
req.state.pop("user", None)
|
|
380
373
|
req.state.pop("auth_guard", None)
|
|
374
|
+
req.state[CONTEXT_LOGGED_OUT_KEY] = True
|
|
381
375
|
|
|
382
376
|
@staticmethod
|
|
383
377
|
async def _revoke_raw_token(
|
|
@@ -566,6 +560,8 @@ class CurrentUser(dict[str, Any]):
|
|
|
566
560
|
self._last_synced: dict[str, Any] = {}
|
|
567
561
|
if data is None:
|
|
568
562
|
ctx_user = Context.get("__swiftpy_current_user__")
|
|
563
|
+
if ctx_user is None:
|
|
564
|
+
ctx_user = _adopt_request_state_user()
|
|
569
565
|
initial = dict(ctx_user) if isinstance(ctx_user, dict) else {}
|
|
570
566
|
super().__init__(initial)
|
|
571
567
|
self._last_synced = dict(initial)
|
|
@@ -589,6 +585,8 @@ class CurrentUser(dict[str, Any]):
|
|
|
589
585
|
if not self._lazy:
|
|
590
586
|
return
|
|
591
587
|
ctx_user = Context.get("__swiftpy_current_user__")
|
|
588
|
+
if ctx_user is None:
|
|
589
|
+
ctx_user = _adopt_request_state_user()
|
|
592
590
|
target = ctx_user if isinstance(ctx_user, dict) else {}
|
|
593
591
|
if target != self._last_synced:
|
|
594
592
|
self._apply_context_payload(target)
|
|
@@ -687,7 +685,10 @@ def current_user() -> Any:
|
|
|
687
685
|
Retrieve the authenticated user payload/record for the current request task.
|
|
688
686
|
Returns None if unauthenticated.
|
|
689
687
|
"""
|
|
690
|
-
|
|
688
|
+
user = Context.get("__swiftpy_current_user__")
|
|
689
|
+
if user is None:
|
|
690
|
+
user = _adopt_request_state_user()
|
|
691
|
+
return user
|
|
691
692
|
|
|
692
693
|
|
|
693
694
|
class AuthManager:
|
|
@@ -15,6 +15,7 @@ from swiftpy.auth.exceptions import (
|
|
|
15
15
|
)
|
|
16
16
|
from swiftpy.auth.jwt_issuer import JWTIssuer
|
|
17
17
|
from swiftpy.auth.token_blacklist import TokenBlacklist, is_token_blacklist_enabled
|
|
18
|
+
from swiftpy.auth.user_context import hydrate_jwt_user_context
|
|
18
19
|
from swiftpy.core.config import Config
|
|
19
20
|
from swiftpy.core.container import get_container
|
|
20
21
|
from swiftpy.core.context import Context
|
|
@@ -181,13 +182,12 @@ async def require_jwt(
|
|
|
181
182
|
"Authentication service unavailable"
|
|
182
183
|
) from exc
|
|
183
184
|
|
|
184
|
-
# 7.
|
|
185
|
-
|
|
185
|
+
# 7. Hydrate user context (from DatabasePool when available) and attach to request state & Context
|
|
186
|
+
user_ctx = await hydrate_jwt_user_context(payload)
|
|
187
|
+
req.state["user"] = user_ctx
|
|
186
188
|
req.state["auth_guard"] = "jwt"
|
|
187
|
-
Context.set("__swiftpy_current_user__", payload)
|
|
188
|
-
Context.set("__swiftpy_auth_guard__", "jwt")
|
|
189
189
|
|
|
190
|
-
return
|
|
190
|
+
return user_ctx
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
class JWTGuard(Middleware):
|
|
@@ -9,7 +9,7 @@ import math
|
|
|
9
9
|
import secrets
|
|
10
10
|
import time
|
|
11
11
|
import uuid
|
|
12
|
-
from collections.abc import Callable
|
|
12
|
+
from collections.abc import Callable, Mapping
|
|
13
13
|
from datetime import timedelta
|
|
14
14
|
from typing import Any, ClassVar, Protocol, TypeGuard
|
|
15
15
|
|
|
@@ -32,12 +32,18 @@ from swiftpy.auth.exceptions import (
|
|
|
32
32
|
TokenRevokedError,
|
|
33
33
|
is_token_blacklist_enabled,
|
|
34
34
|
)
|
|
35
|
+
from swiftpy.auth.user_context import (
|
|
36
|
+
TokenSubject,
|
|
37
|
+
bind_jwt_user_context,
|
|
38
|
+
extract_subject_and_user,
|
|
39
|
+
hydrate_jwt_user_context,
|
|
40
|
+
)
|
|
35
41
|
from swiftpy.core.config import Config, ConfigurationError
|
|
36
42
|
from swiftpy.core.container import Container, get_container
|
|
43
|
+
from swiftpy.database.orm.model import Model
|
|
37
44
|
|
|
38
45
|
logger = logging.getLogger("swiftpy.auth.jwt")
|
|
39
46
|
|
|
40
|
-
|
|
41
47
|
class RefreshTokenBlacklist(Protocol):
|
|
42
48
|
"""Structural protocol for token blacklist implementations used during refresh."""
|
|
43
49
|
|
|
@@ -311,15 +317,19 @@ class JWTIssuer:
|
|
|
311
317
|
|
|
312
318
|
def issue_token(
|
|
313
319
|
self,
|
|
314
|
-
subject:
|
|
320
|
+
subject: TokenSubject,
|
|
315
321
|
token_type: str = "access",
|
|
316
322
|
claims: dict[str, Any] | None = None,
|
|
317
323
|
expires_in: int | timedelta | None = None,
|
|
318
324
|
algorithm: str | None = None,
|
|
319
325
|
not_before: int | timedelta | None = None,
|
|
326
|
+
*,
|
|
327
|
+
user: Model | Mapping[str, Any] | None = None,
|
|
320
328
|
) -> str:
|
|
321
329
|
"""
|
|
322
330
|
Issue a signed JSON Web Token with standard and custom claims.
|
|
331
|
+
When `token_type == "access"`, binds the authenticated user context into
|
|
332
|
+
task-scoped `Context` so `CurrentUser` and `auth()` are available immediately.
|
|
323
333
|
"""
|
|
324
334
|
alg = self.algorithm if algorithm is None else algorithm
|
|
325
335
|
if not isinstance(alg, str) or alg not in self.SUPPORTED_ALGORITHMS:
|
|
@@ -332,6 +342,11 @@ class JWTIssuer:
|
|
|
332
342
|
f"Cannot override reserved JWT claim(s): {', '.join(sorted(conflicting))}"
|
|
333
343
|
)
|
|
334
344
|
|
|
345
|
+
sub_str, user_model, extra_fields = extract_subject_and_user(
|
|
346
|
+
subject,
|
|
347
|
+
user=user,
|
|
348
|
+
)
|
|
349
|
+
|
|
335
350
|
now = int(time.time())
|
|
336
351
|
ttl_seconds: int
|
|
337
352
|
if expires_in is not None:
|
|
@@ -352,7 +367,7 @@ class JWTIssuer:
|
|
|
352
367
|
)
|
|
353
368
|
|
|
354
369
|
payload: dict[str, Any] = {
|
|
355
|
-
"sub":
|
|
370
|
+
"sub": sub_str,
|
|
356
371
|
"type": token_type,
|
|
357
372
|
"token_type": token_type,
|
|
358
373
|
"typ": token_type,
|
|
@@ -400,27 +415,40 @@ class JWTIssuer:
|
|
|
400
415
|
signature_bytes = self._sign(signing_input, alg)
|
|
401
416
|
signature_b64 = _base64url_encode(signature_bytes)
|
|
402
417
|
|
|
418
|
+
if token_type == "access":
|
|
419
|
+
bind_jwt_user_context(
|
|
420
|
+
payload,
|
|
421
|
+
user_model=user_model,
|
|
422
|
+
extra_fields=extra_fields,
|
|
423
|
+
preserve_different_subject=True,
|
|
424
|
+
)
|
|
425
|
+
|
|
403
426
|
return f"{header_b64}.{payload_b64}.{signature_b64}"
|
|
404
427
|
|
|
405
428
|
def issue_access_token(
|
|
406
429
|
self,
|
|
407
|
-
subject:
|
|
430
|
+
subject: TokenSubject,
|
|
408
431
|
claims: dict[str, Any] | None = None,
|
|
409
432
|
expires_in: int | timedelta | None = None,
|
|
433
|
+
*,
|
|
434
|
+
user: Model | Mapping[str, Any] | None = None,
|
|
410
435
|
) -> str:
|
|
411
|
-
"""Issue a short-lived access token."""
|
|
436
|
+
"""Issue a short-lived access token and bind active user context."""
|
|
412
437
|
return self.issue_token(
|
|
413
438
|
subject=subject,
|
|
414
439
|
token_type="access",
|
|
415
440
|
claims=claims,
|
|
416
441
|
expires_in=self.access_token_ttl if expires_in is None else expires_in,
|
|
442
|
+
user=user,
|
|
417
443
|
)
|
|
418
444
|
|
|
419
445
|
def issue_refresh_token(
|
|
420
446
|
self,
|
|
421
|
-
subject:
|
|
447
|
+
subject: TokenSubject,
|
|
422
448
|
claims: dict[str, Any] | None = None,
|
|
423
449
|
expires_in: int | timedelta | None = None,
|
|
450
|
+
*,
|
|
451
|
+
user: Model | Mapping[str, Any] | None = None,
|
|
424
452
|
) -> str:
|
|
425
453
|
"""Issue a long-lived refresh token."""
|
|
426
454
|
return self.issue_token(
|
|
@@ -428,15 +456,18 @@ class JWTIssuer:
|
|
|
428
456
|
token_type="refresh",
|
|
429
457
|
claims=claims,
|
|
430
458
|
expires_in=self.refresh_token_ttl if expires_in is None else expires_in,
|
|
459
|
+
user=user,
|
|
431
460
|
)
|
|
432
461
|
|
|
433
462
|
def issue_token_pair(
|
|
434
463
|
self,
|
|
435
|
-
subject:
|
|
464
|
+
subject: TokenSubject,
|
|
436
465
|
claims: dict[str, Any] | None = None,
|
|
437
466
|
access_expires_in: int | timedelta | None = None,
|
|
438
467
|
refresh_expires_in: int | timedelta | None = None,
|
|
439
468
|
refresh_claims: dict[str, Any] | None = None,
|
|
469
|
+
*,
|
|
470
|
+
user: Model | Mapping[str, Any] | None = None,
|
|
440
471
|
) -> dict[str, Any]:
|
|
441
472
|
"""
|
|
442
473
|
Issue both an access token and a refresh token.
|
|
@@ -447,11 +478,13 @@ class JWTIssuer:
|
|
|
447
478
|
subject=subject,
|
|
448
479
|
claims=claims,
|
|
449
480
|
expires_in=access_expires_in,
|
|
481
|
+
user=user,
|
|
450
482
|
)
|
|
451
483
|
refresh_token = self.issue_refresh_token(
|
|
452
484
|
subject=subject,
|
|
453
485
|
claims=refresh_claims,
|
|
454
486
|
expires_in=refresh_expires_in,
|
|
487
|
+
user=user,
|
|
455
488
|
)
|
|
456
489
|
ttl = self.access_token_ttl if access_expires_in is None else access_expires_in
|
|
457
490
|
ttl_seconds = int(ttl.total_seconds() if isinstance(ttl, timedelta) else ttl)
|
|
@@ -600,13 +633,23 @@ class JWTIssuer:
|
|
|
600
633
|
else (inherited_refresh_claims or None)
|
|
601
634
|
)
|
|
602
635
|
|
|
603
|
-
|
|
636
|
+
pair = self.issue_token_pair(
|
|
604
637
|
subject=subject,
|
|
605
638
|
claims=claims,
|
|
606
639
|
access_expires_in=access_expires_in,
|
|
607
640
|
refresh_expires_in=refresh_expires_in,
|
|
608
641
|
refresh_claims=resolved_refresh_claims,
|
|
609
642
|
)
|
|
643
|
+
access_payload = self.decode_token(
|
|
644
|
+
pair["access_token"],
|
|
645
|
+
verify_exp=False,
|
|
646
|
+
verify_nbf=False,
|
|
647
|
+
)
|
|
648
|
+
await hydrate_jwt_user_context(
|
|
649
|
+
access_payload,
|
|
650
|
+
preserve_different_subject=True,
|
|
651
|
+
)
|
|
652
|
+
return pair
|
|
610
653
|
|
|
611
654
|
def decode_token(
|
|
612
655
|
self,
|