Skip to main content

Django app to integrate with the centralized Moni authentication system

Project description

  1. Add moni_auth to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...,
        "moni_auth",
    ]
  2. Include the moni-auth URLconf in your urls.py like this:

    path("moni-auth/", include("moni_auth.urls")),
    path("admin/login/", CustomAdminLoginView.as_view()), # Import this view from moni_auth.views
  3. Include the exception handler into the REST_FRAMEWORK config:

    REST_FRAMEWORK = {
        ...,
        'EXCEPTION_HANDLER': 'moni_auth.exceptions.custom_exception_handler',
    }
  4. Add the following variables to the settings:

    MONI_AUTH = {
        "JWT_SECRET_KEY": env.str("JWT_SECRET_KEY", "DJjZ1sFPZAf1cfA0yqd3ufvLbc7E1r_JYMuu3Rqx5Pk"),
        "JWT_DEBUG": env.bool("JWT_DEBUG", False),
        "JWT_KEY": env.str("JWT_KEY", "jwt_wt"), # -> Main JWT for the service
        "JWT_KEYS": env.list("JWT_KEYS", default=["jwt_wt", "jwt_cs"]), # -> Array of JWTs that will be checked on the BaseJWTPermission to check for pages
        "BO_AUTH_LOGIN_URL": env.str("BO_AUTH_LOGIN_URL", "http://localhost:3000/login"),
        "AUTHENTICATION_SERVICE_URL": env.str("AUTHENTICATION_SERVICE_URL", "http://auth-django-1:8000"),
        "SHARED_SECRET_TOKEN": env.str("SHARED_SECRET_TOKEN", "3bqLVv3TlI_-2x2vEwN5N0Q_6IuX7n5kCnpJhZ8UAGo4xImfD"),
        "PRODUCTS": {}, # -> Import the product constants for the project
    }

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

moni-auth-1.0.2.tar.gz (9.0 kB view details)

Uploaded Source

File details

Details for the file moni-auth-1.0.2.tar.gz.

File metadata

  • Download URL: moni-auth-1.0.2.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for moni-auth-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1c23e39bf2d60d747d64f1c1d01d81ac367f8ae9754453e3d48e9ebe6b4288b3
MD5 9c9ada445c515fb42fa33a1b4377381c
BLAKE2b-256 84635a2c93add44febff1d92b2fd45623040bff3f5f1c4be70e78ac7aee67d05

See more details on using hashes here.

Supported by

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