The Mini Identity Provider for Local Development and Testing
- Provide the bare-bone compatibility with OAuth2 standards (authorization flow, device code flow, client credentials flow).
(Future)
- OTP Support
- Python 3.9 or newer
- PostgreSQL 16 or newer (compatible with 14+)
- For macOS and Linux, use
psycopgfor the driver. - For Windows, use
pg8000for the driver.
- For macOS and Linux, use
- Python virtual environment, either one of these works.
venv- Python's built-in virtual environmentpoetry- https://python-poetry.org/docs/
- Copy
.env.distto.envand modify as needed.
- With
venv...- Initialize a new virtual environment with:
python3 -m venv .venv
- Activate the virtual environment with:
./venv/bin/activate
This is the simplest option for quick work.
- Initialize a new virtual environment with:
- With
poetry...- Install
poetry.WARNING: If you are using IntelliJ or PyCharm, please ensure that poetry is accessible via the default execute path (
$PATH) as IntelliJ/PyCharm can detect wherepoetryis but cannot find it for some reason. - Install the shell plugin with:
poetry self add poetry-plugin-shell
- Activate the environment with:
or
# poetry 1.8 poetry shell# poetry 2.1 $(poetry env activate)
- Install
- Install dependencies
Some libraries may not work correctly. Please fix compatibility issues case by case.
Run the SQL scripts in migrations/ in the alphanumeric order.
export MINI_IDP_DB_NAME=miniidp
psql "postgres://postgres:nosecret@localhost:5432/postgres" -c "CREATE DATABASE ${MINI_IDP_DB_NAME}"
psql "postgres://postgres:nosecret@localhost:5432/${MINI_IDP_DB_NAME}" -v ON_ERROR_STOP=1 -f migrations/001-init.sqlYou can name the database to whatever you want.
In the development and testing, you can also define the environment variable
MINI_IDP_BOOTING_OPTIONSwithbootstrap:data-reset(operational data) or bootstrap:session-reset` (session data).
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem- All network operations (DB, HTTP) may still be blocking or running in a different thread. This will be improved over time.
- https://datatracker.ietf.org/doc/html/rfc8628
- https://developer.okta.com/docs/guides/device-authorization-grant/main/
- https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-on-behalf-of-flow
- https://developer.okta.com/docs/guides/set-up-token-exchange/main/
- FastAPI - © Sebastián Ramírez. Used under MIT license
- Imagination - © Juti Noppornpitak. Used under MIT license
- Material Symbols - © Google Inc. Used under Apache 2 license
- (TBD)