Skip to main content

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

image image image image image image image image

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

  1. Add to your INSTALLED_APPS settings:

    INSTALLED_APPS = [
        ...
        "organizations",
        "django_extensions",
        "django_nats_nkey",
    ]
    
  2. Run python manage.py migrate to create the NATS organizationals models

  3. 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 running nsc pull as a pre-deployment step.

Contributor's Guide

  1. Create a development environment (requires docker & docker-compose):

    make docker-up
    make nsc-init
    
  2. Run tests and generate a coverage report:

    make pytest
    
  3. 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_nats_nkeys-0.6.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

django_nats_nkeys-0.6.1-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file django_nats_nkeys-0.6.1.tar.gz.

File metadata

  • Download URL: django_nats_nkeys-0.6.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for django_nats_nkeys-0.6.1.tar.gz
Algorithm Hash digest
SHA256 d6e296a7b6ede7143eb3a4d37f799abcffb65d70900cc5f5bb495673b03d3187
MD5 81f86d4192ef5f7b39dbc806636a2e6e
BLAKE2b-256 2361f664d1644321833bb784ab3796ca6c424a835dc84603d76e8d5f4aa8c87a

See more details on using hashes here.

File details

Details for the file django_nats_nkeys-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_nats_nkeys-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9e91861d0206e2f9744593250ba8201c737fc08659e22078f7a56d66666a02b
MD5 bde5b4a1cb725c29e8aff9bdc5289156
BLAKE2b-256 865bf470c70a167ceaa593bd935fed4c221596aeb42072e0382f0a562e3c00f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page