Skip to main content

Django middleware for authorizing requests based on headers.

Project description

Django Header Auth
==================

An extremely simple Django middleware for authorizing requests based on headers.

Installation
------------

1. Install via pip:

:::bash
$ pip install django-header-auth

2. Add the `HeaderAuthMiddleware`:

:::python
MIDDLEWARE_CLASSES = (
# ...
'header_auth.middleware.HeaderAuthMiddleware',
# ...
)

Usage
-----

Add a `HEADER_AUTH` dict containing the headers you'd like to check to the settings file:

:::python
HEADER_AUTH = {
'HTTP_X_SOME_HEADER': 'sometoken',
'HTTP_X_ANOTHER_HEADER': 'anothertoken',
}

The request's headers will be checked for 'X-Some-Header: sometoken' and 'X-Another-Header: anothertoken' and simply pass through if everything is ok. Otherwise a 403 Forbidden will be returned.

Copyright
---------

Copyright (c) 2013 [LocalMed, Inc.](http://www.localmed.com/). See LICENSE for details.

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-header-auth-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file django-header-auth-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-header-auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f703dc4c860c0743852838151b9143ce0a7bddec9be799062e56543b4a70b47e
MD5 af75aa645186e53d8f87532d89f0fe63
BLAKE2b-256 089aeaf407d0bb41407883cea28e9ce92dda936c7ac10dcaf9aa6c3fc79ad331

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