Shared Cognito authentication library for FastAPI + Jinja2 web apps
Project description
daylily-cognito
daylily-cognito is the shared Cognito/auth library and operational CLI for the stack. It gives service repos a common way to model pool/app context, build FastAPI auth helpers, and manage Cognito pools, clients, users, groups, and optional Google IdP configuration without each repo inventing its own wrapper.
daylily-cognito owns:
- reusable Cognito configuration objects
- shared auth helpers for FastAPI integrations
- the
daycogoperational CLI for pool/app/user/group flows - Google IdP support and context/config synchronization
daylily-cognito does not own:
- a product’s session UI or page composition
- product-specific RBAC semantics
- non-Cognito identity providers beyond its supported helpers
Component View
flowchart LR
Apps["FastAPI apps"] --> Lib["daylily-cognito library"]
Operators["daycog CLI"] --> Lib
Lib --> Cognito["AWS Cognito"]
Lib --> Google["optional Google OAuth IdP"]
Prerequisites
- Python 3.9+
- AWS credentials/profile for any live Cognito management
- optional
authextra for JWT verification support - optional Google OAuth client JSON for Google IdP flows
Getting Started
Quickstart: Local Library Use
pip install -e ".[auth]"
from daylily_cognito import CognitoConfig, CognitoAuth
config = CognitoConfig(
name="myapp",
region="us-west-2",
user_pool_id="us-west-2_XXXXXXXXX",
app_client_id="XXXXXXXXXXXXXXXXXXXXXXXXXX",
)
config.validate()
auth = CognitoAuth(
region=config.region,
user_pool_id=config.user_pool_id,
app_client_id=config.app_client_id,
)
Quickstart: CLI Workflow
source ./activate
daycog --help
daycog status
Creating or mutating pools, apps, or users is a live AWS operation. Treat daycog setup, add-app, delete-pool, and similar commands as stateful actions.
Architecture
Technology
- Python library for Cognito config/auth helpers
- Typer-based
daycogCLI - optional JWT verification helpers
- optional Google IdP integration
Core Model
The repo revolves around:
- Cognito config contexts
- user pools
- app clients
- users and groups
- environment-variable and config-file loading patterns
- optional Google OAuth IdP wiring
Runtime Shape
- library package:
daylily_cognito - CLI entrypoint:
daycog - common workflows: context/config inspection, pool/app creation, app management, user/group operations, Google IdP setup
Cost Estimates
Approximate only.
- Local-only development with mocked or existing config: near-zero direct cost.
- Live AWS use depends on Cognito usage, domains, MAU, and any external IdP posture; dev/test tends to be modest compared with a full application environment.
Development Notes
- Canonical local entry path:
source ./activate - Use
daycog ...as the primary operational interface - Prefer config contexts or namespaced environment variables over ad hoc per-app auth glue
Useful checks:
source ./activate
daycog --help
pytest -q
Sandboxing
- Safe: docs work, code reading, tests, config inspection,
daycog --help, and local config-file work - Requires extra care: any command that creates, edits, or deletes Cognito pools, apps, users, groups, or domains
Current Docs
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daylily_cognito-0.1.33.tar.gz.
File metadata
- Download URL: daylily_cognito-0.1.33.tar.gz
- Upload date:
- Size: 73.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
718cabbf7528a0e11f4b9c7ddceffb5aa36fd98fc65cf162288aab658e6713ca
|
|
| MD5 |
0949e08e21a24cddcd62f3de4548fd0f
|
|
| BLAKE2b-256 |
b7f5936e15cf1a4f3c42647a2922a0e9aafdd3bf259bd3c6898995d9439a5b4e
|
File details
Details for the file daylily_cognito-0.1.33-py3-none-any.whl.
File metadata
- Download URL: daylily_cognito-0.1.33-py3-none-any.whl
- Upload date:
- Size: 45.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3fdf6bed11ed7a8d5f7aaf5bfd9da001ebda18de8e03fc82eb801e519829f8
|
|
| MD5 |
5a879a75056768a49594ac82ce3ef990
|
|
| BLAKE2b-256 |
09c35eeca36321bb9cee036060f45f9d3c86fb89993c19311c50d786b72eb548
|