Skip to main content

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

Release files for wsgi-basic-auth 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wsgi-basic-auth 1.1.0
File Size Uploaded
wsgi-basic-auth-1.1.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wsgi-basic-auth 1.1.0
File Interpreter ABI Platform
wsgi_basic_auth-1.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.4 kB

Release files / wsgi-basic-auth-1.1.0.tar.gz

Download URL wsgi-basic-auth-1.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4afe7bafc2c8dae4d4232adca06d3cd49c833565378a3133a53d788cda5c37b3
BLAKE2b-256 checksum
How to use checksums
ca0037a566ad4d4f1860527e7b3a65368b9c59ac2111660d0d91d4380734246f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / wsgi_basic_auth-1.1.0-py2.py3-none-any.whl

Download URL wsgi_basic_auth-1.1.0-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
956e61eaca26c5834bbce0097be5d4aaf19a86df3bc873988764ebf0f8422b66
BLAKE2b-256 checksum
How to use checksums
9cc13a40f56e65149d83207af141271ed970d60496afc837f3f09987d2e1b6bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page