Skip to main content

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

Project description

Django-HMAC
==========

|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
~~~~~~~~~~~~~

.. sourcecode:: python

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

.. sourcecode::

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


.. |circle| image:: https://img.shields.io/circleci/project/thisissoon/djangohmac.svg
:target: https://circleci.com/gh/thisissoon/djangohmac

.. |downloads| image:: http://img.shields.io/pypi/dm/djangohmac.svg
:target: https://pypi.python.org/pypi/djangohmac

.. |version| image:: http://img.shields.io/pypi/v/djangohmac.svg
:target: https://pypi.python.org/pypi/djangohmac

.. |license| image:: http://img.shields.io/pypi/l/djangohmac.svg
:target: https://pypi.python.org/pypi/djangohmac

.. |docs| image:: https://readthedocs.org/projects/djangohmac/badge/?version=latest
:target: http://djangohmac.readthedocs.org/en/latest/?badge=latest

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

djangohmac-1.3.2.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file djangohmac-1.3.2.tar.gz.

File metadata

  • Download URL: djangohmac-1.3.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djangohmac-1.3.2.tar.gz
Algorithm Hash digest
SHA256 7e59ac211d8712a2a0fc8d142e1824385a1288194bfb90529e85430b763b7b72
MD5 87440111a92b7cc6a9ea1b60801700e4
BLAKE2b-256 5685870f81b4a638e590cf8f732e4926a1aa097d9ec2b9433dcc50aff50b7397

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