Skip to main content

1 Welcome to zgw-auth-backend’s documentation!

Version:

1.0.4

Source:

https://github.com/maykinmedia/zgw-auth-backend

Keywords:

zgw, vng, apis, drf

PythonVersion:

3.8

Run CI Coverage status Code linting black

python-versions django-versions pypi-version

A Django REST framework authentication class for the ZGW API authentication pattern.

The ZGW Auth JWT includes claims for user_id and user_representation. This information can be used in your API to authenticate the actual end-user, even when using gateway APIs.

2 Features

  • Authenticates the end-user based on the user_id JWT claim

  • Follows the auth spec for “API’s voor zaakgericht werken”

3 Installation

3.1 Requirements

  • Python 3.7 or higher

  • setuptools 30.3.0 or above

  • Django 2.2 or newer

3.2 Install

pip install zgw-auth-backend

Add it to your installed apps:

INSTALLED_APPS += ["zgw_auth_backend"]

Migrate:

python manage.py migrate

Optionally, you can add it to DRFs default backends:

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": [
        ...,
        "zgw_auth_backend.authentication.ZGWAuthentication",
        ...,
    ],
}

4 Usage

Specify the authentication class on your view(s):

from rest_framework import views
from zgw_auth_backend.authentication import ZGWAuthentication

class MyView(APIView):
    authentication_classes = (ZGWAuthentication,)
  1. Add the client credentials in the admin (client ID + secret)

  2. Generate a ZGW auth JWT with the user_id claim, using the credentials from step 1

  3. Make an API call to the endpoint, including the Authorization: Bearer <jwt> header

  4. Verify that the user with user_id username is created if it didn’t exist yet, or if it did, that request.user is now this user.

Metadata

Release files for zgw-auth-backend 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zgw-auth-backend 1.0.4
File Size Uploaded Provenance
zgw-auth-backend-1.0.4.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zgw-auth-backend 1.0.4
File Interpreter ABI Platform
zgw_auth_backend-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / zgw-auth-backend-1.0.4.tar.gz

Download URL zgw-auth-backend-1.0.4.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
241d87c9c05a3a19efe8f486adadc745886164de9f0bfd44b1929854c0baae86
BLAKE2b-256 checksum
How to use checksums
4471efc44c047a21d8b7d7b2e7fa7eb6386189efdd5c910a48340539f8d9d4e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

Release files / zgw_auth_backend-1.0.4-py3-none-any.whl

Download URL zgw_auth_backend-1.0.4-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c22e99fab473b05d87c27d3ed58fd38984d023f42ceb709e8e5475e8c30ae640
BLAKE2b-256 checksum
How to use checksums
4835b1c9079e5dbbefbe9e3f1841aa22b388990cabb8ae5d3d0e0d47a9e5e238
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

Security for zgw-auth-backend 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page