Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

WSGI HTTP Digest Authentication middleware

Project description

a WSGI middleware that secures some/all routes using HTTP Digest Authentication.

Installation

pip install httpauth

Using with credentials dictionary

secured_wsgi_app = httpauth.DictHttpAuthMiddleware(
   {'user1': 'password1', 'user2': 'password2'},
   wsgi_app=unsecured_wsgi_app,
   #realm='Secured Content', # optional
)

Using with a .htdigest file

secured_wsgi_app = httpauth.DigestFileHttpAuthMiddleware(
   open('/path/to/your/.htdigest'),
   wsgi_app=unsecured_wsgi_app,
)

.htdigest files can be created using the htdigest Apache tool.

Securing only some URLs

If given, the routes parameter (a list of regular expressions) specifies the URLs to be secured. (By default, all URLs are secured.)

secured_wsgi_app = httpauth.DictHttpAuthMiddleware(
   {'user': 'password'},
   wsgi_app=unsecured_wsgi_app,
   routes=['^/admin/', '^/another/secret/page/$'],
)

Project details


Download files

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

Files for httpauth, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size httpauth-0.3.tar.gz (4.4 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