Skip to main content

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.

Source Distribution

httpauth-0.3.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file httpauth-0.3.tar.gz.

File metadata

  • Download URL: httpauth-0.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for httpauth-0.3.tar.gz
Algorithm Hash digest
SHA256 74645a5c3cf7d094fb3b6803b789453ade634f2eb7d177d149dfbf680e3a5a61
MD5 5e9c5f0d5df071cdb923453e6ae7bd96
BLAKE2b-256 f00f4d7a1807471c452c0097f30d9ce7ddd535e34036ce5cef6c3a3de66c39ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page