Skip to main content

Simple wsgi middleware to provide basic http auth

Project description

Really simple wsgi middleware to provide basic http auth. It is intented to work with environment variables. This makes it simple to use in a docker context.

Status

https://readthedocs.org/projects/wsgi-basic-auth/badge/?version=latest https://travis-ci.org/mvantellingen/wsgi-basic-auth.svg?branch=master https://ci.appveyor.com/api/projects/status/im609ng9h29vt89r?svg=true http://codecov.io/github/mvantellingen/wsgi-basic-auth/coverage.svg?branch=master https://img.shields.io/pypi/v/wsgi-basic-auth.svg

Getting started

Using this module is really simple. In Django for example edit the wsgi.py file and add the following to the end of the file.

from wsgi_basic_auth import BasicAuth
application = BasicAuth(application)

Now run docker with the env variable WSGI_AUTH_CREDENTIALS=foo:bar and you have to authenticate with username foo and password bar. Multiple credentials are separated with a | (pipe) character.

To exclude specific paths for healthchecks (e.g. the Amazon ELB healthchecks) specify the environment variable WSGI_AUTH_EXCLUDE_PATHS=/api/healthchecks. Here multiple paths can be separated with the ; char.

To include only specific paths specify the environment variable WSGI_AUTH_EXCLUDE_PATHS. Here multiple paths can be separated with the ; char.

You can use both include and exclude paths together for example: WSGI_AUTH_PATHS=/foo WSGI_AUTH_EXCLUDE_PATHS=/foo/bar This will force Basic Auth on all paths under /foo except /foo/bar

Installation

You can install the latest version using pip:

pip install wsgi-basic-auth

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

wsgi-basic-auth-1.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

wsgi_basic_auth-1.1.0-py2.py3-none-any.whl (5.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wsgi-basic-auth-1.1.0.tar.gz.

File metadata

File hashes

Hashes for wsgi-basic-auth-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4afe7bafc2c8dae4d4232adca06d3cd49c833565378a3133a53d788cda5c37b3
MD5 164c285ee278ab47f14ed8f810b66368
BLAKE2b-256 ca0037a566ad4d4f1860527e7b3a65368b9c59ac2111660d0d91d4380734246f

See more details on using hashes here.

File details

Details for the file wsgi_basic_auth-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wsgi_basic_auth-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 956e61eaca26c5834bbce0097be5d4aaf19a86df3bc873988764ebf0f8422b66
MD5 e6f8d6c05df2dc53e54b8d3f913f6628
BLAKE2b-256 9cc13a40f56e65149d83207af141271ed970d60496afc837f3f09987d2e1b6bb

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