Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonashaag/httpauth
WSGI HTTP Digest Auth middleware
https://github.com/jonashaag/httpauth
Last synced: 9 days ago
JSON representation
WSGI HTTP Digest Auth middleware
- Host: GitHub
- URL: https://github.com/jonashaag/httpauth
- Owner: jonashaag
- License: isc
- Created: 2012-07-10T10:51:17.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T09:47:15.000Z (5 months ago)
- Last Synced: 2024-10-14T16:58:22.022Z (23 days ago)
- Language: Python
- Size: 29.3 KB
- Stars: 5
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
httpauth
========a WSGI middleware that secures some/all routes using HTTP Digest Authentication.
.. image:: https://travis-ci.org/jonashaag/httpauth.svg?branch=master
:target: https://travis-ci.org/jonashaag/httpauthInstallation
------------
::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/$'],
)