Skip to main content

Provides easy integration of the HMAC signatures for your REST Django Applications.

Project description

circle downloads version license docs

This module provides a middleware for HMAC signature Django views. It’s simply designed to check that a client is entitled to access routes, based on the fact that it must possess a copy of the secret key.

Key features:

  • HMAC Middleware

  • HMAC View decorators

  • Multiple keys for more services

  • Service restricted access

Small example

class SignedView(View):

    @decorators.auth
    def get(self, request):
        return HttpResponse("for all services")

    @decorators.auth(only=['userservice'])
    def post(self, request):
        return HttpResponse("Only for user service")

Dev

To run all tests

docker run -it -v $PWD:/src -w /src ikalnitsky/pythonista tox

Change Log

1.3.2

  • Fix - unicode key

1.3.1

  • Get rid of brackets in decorator

  • Bugfix: valid signature for resticted view passed validation

1.3.0

  • Merge validation of multiple and single signature to single method

  • Replace middleware classes to one single class HmacMiddleware

1.2.0

  • Decorators

1.0.5

  • Fix: Django HTTP headers

1.0.4

  • Fix: use base64.b64encode instead of base64.urlsafe_b64encode

1.0.2

  • Fix: HMAC_SECRET should be optional

  • GlobalHmacMiddleware and MultipleHmacMiddleware

0.0.1

  • Initial release including the core feature set

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

djangohmacv3-1.3.3.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file djangohmacv3-1.3.3.tar.gz.

File metadata

  • Download URL: djangohmacv3-1.3.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for djangohmacv3-1.3.3.tar.gz
Algorithm Hash digest
SHA256 a3185cdf22d98798f4f31589e547478c5f41b69eb1e3bff5710e02c4ff3dce7d
MD5 b7659030fdd28b0993fa6dadb5695c69
BLAKE2b-256 10f9a36fdad218e2bf3e5262db3cb5ffad1876429597020b086447894bb5fc51

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