Django NATS Nkey is a Django app to synchronize Django superusers, accounts, and users with NATS nkey-based authentization/authorization scheme
Project description
Django Nats NKEYS
NATS is an infrastructure platform for building message-based services.
This Django app integrates NAT's multi-tenant account paradigm with Django Organizations.
The NATS nsc
tool is used to manage operator, account, and user JWTs.
Quick start
-
Add to your INSTALLED_APPS settings:
INSTALLED_APPS = [ ... "organizations", "django_extensions", "django_nats_nkey", ]
-
Run
python manage.py migrate
to create the NATS organizationals models -
Run
python manage.py nsc-init
(optional) Initialize a new NATS operator. You are responsible for copying the generated.conf
file to your NATS server. If you choose to use an existing operator, you are responsible for runningnsc pull
as a pre-deployment step.
Contributor's Guide
-
Create a development environment (requires docker & docker-compose):
make docker-up make nsc-init
-
Run tests and generate a coverage report:
make pytest
-
Run
black
linter:make lint
Settings
Basic Settings
NATS_NSC_DATA_DIR
(default: "/var/lib/nats/nsc/stores"
or $NSC_STORE
environment var)
NATS_NSC_CONFIG_DIR
(default: "/var/lib/nats/nsc/config"
or $NSC_HOME
environment var)
NATS_NSC_KEYSTORE_DIR
(default: "/var/lib/nats/nsc/keys"
or $NKEYS_PATH
environment var)
NATS_SERVER_URI
(default: "nats://nats:4222"
)
NATS_NKEYS_IMPORT_DIR
(default: ".nats/"
, )
NATS_NKEYS_EXPORT_DIR
(default: ".nats/"
)
NATS_NKEYS_OPERATOR_NAME
(default: "DjangoOperator"
)
Organization Models
- Based on Django organizations
- An
Organization
represents anaccount
in NATS multi-tenant account model - An
App
represents auser
in NATS multi-tenant account model
NATS_ORGANIZATION_MODEL
(default: "django_nats_nkeys.NatsOrganization"
)
- Must subclass
django_nats_nkeys.models.NatsOrganization
NATS_ORGANIZATION_OWNER_MODEL
(default: "django_nats_nkeys.NatsOrganizationOwner"
)
- Must subclass
django_nats_nkey.models.NatsOrganizationOwner
NATS_ORGANIZATION_APP_MODEL
(default: "django_nats_nkey.NatsOrganizationApp"
)
- Must subclass
django_nats_nkey.models.AbstractNatsApp
NATS_ORGANIZATION_USER_MODEL
(default: "django_nats_nkeys.models.NatsOrganizationUser"
)
- Must subclass
django_nats_nkeys.models.NatsOrganizationUser
Robot/Automation Models
NATS_ROBOT_APP_MODEL
(default: "django_nats_nkeys.NatsRobotApp"
)
NATS_ROBOT_ACCOUNT_MODEL
(default: "django_nats_nkeys.NatsRobotAccount"
)
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
File details
Details for the file django_nats_nkeys-0.6.2.tar.gz
.
File metadata
- Download URL: django_nats_nkeys-0.6.2.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e75d190411d9b6fde678f2d6b11a0e350489e020c61d3649751d3d614f3d9f0 |
|
MD5 | 01aaa53b36f1b1f1dab13287c96e12c8 |
|
BLAKE2b-256 | 4c776a2f7a1c046c8255c2790082a94ae90b9a3e472986516810c20c9b8fa955 |
File details
Details for the file django_nats_nkeys-0.6.2-py3-none-any.whl
.
File metadata
- Download URL: django_nats_nkeys-0.6.2-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 569399bc871fb42df500804808c0a9270f8cb0b777b64788e61a43919b56727b |
|
MD5 | 9eb918e6480290d2c6e76a144a7b6890 |
|
BLAKE2b-256 | 8f2cb246c441efa1143f501e295d31e1ee4ddc4503c1568e875de0474ad859bc |