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.


Getting started

Using this module is really simple. In Django for example edit the 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


You can install the latest version using pip:

pip install wsgi-basic-auth

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wsgi-basic-auth, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size wsgi_basic_auth-1.1.0-py2.py3-none-any.whl (5.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size wsgi-basic-auth-1.1.0.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page