tornado-http-auth
Digest and basic authentication for the Tornado web framework. Based on code and ideas from Twisted's cred.
Installation
The latest stable version of tornado-http-auth can be installed from pypi:
pip install tornado-http-auth
Usage
import tornado.ioloop
from tornado.web import RequestHandler, Application
from tornado_http_auth import DigestAuthMixin, BasicAuthMixin, auth_required
credentials = {'user1': 'pass1'}
# Example 1 (using decorator).
class MainHandler(DigestAuthMixin, RequestHandler):
@auth_required(realm='Protected', auth_func=credentials.get)
def get(self):
self.write('Hello %s' % self._current_user)
# Example 2 (using prepare and get_authenticated_user).
class MainHandler(BasicAuthMixin, RequestHandler):
def prepare(self):
self.get_authenticated_user(check_credentials_func=credentials.get, realm='Protected')
def get(self):
self.write('Hello %s' % self._current_user)
app = Application([
(r'/', MainHandler),
])
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
# curl --user user1:pass1 -v http://localhost:8888 -> 200 OK
# curl --user user2:pass2 -v http://localhost:8888 -> 401 Unauthorized
# Remove or comment second class
# curl --digest --user user1:pass1 -v http://localhost:8888 -> 200 OK
# curl --digest --user user2:pass2 -v http://localhost:8888 -> 401 Unauthorized
License
This project is released under the terms of the Apache License, Version 2.0.
Metadata
Release files for tornado-http-auth 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tornado_http_auth-1.2.0.tar.gz | 27.3 kB | Without provenance | Details for tornado_http_auth-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tornado_http_auth-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for tornado_http_auth-1.2.0-py3-none-any.whl |
Total release size: 36.1 kB
Release files / tornado_http_auth-1.2.0.tar.gz
| Download URL | tornado_http_auth-1.2.0.tar.gz |
|---|---|
| Size | 27.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e615c30ceb4be7e12b229cbc14e1cd3240854ef69b9ba7281ff3b70653d455d5
|
|
BLAKE2b-256 checksum How to use checksums |
b38f899322742f155ea8fb5aaa3acd6c168f0603f1d5c69d8498b41bd78215e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tornado_http_auth-1.2.0-py3-none-any.whl
| Download URL | tornado_http_auth-1.2.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cfb952d927269fff8111bd7c1ab4127cb5f990f0a782b09aa599a168af9e3f9
|
|
BLAKE2b-256 checksum How to use checksums |
7a8d8177e9a99eda41749c397a80b58dfe5a35f6aec7328f284ec10813b18bdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tornado-http-auth 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.