Skip to main content

Digest and basic authentication for tornado

Project description

Latest version released on PyPi Apache License, Version 2.0.

Digest and basic authentication for the Tornado web framework. Based on code and ideas in Twisted’s cred.

Installation

The latest stable version of tornado-ansi-markup 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, digest_auth

credentials = {'user1': 'pass1'}

class MainHandler(DigestAuthMixin, RequestHandler):
    @digest_auth(realm='Protected', auth_func=credentials.get)
    def get(self):
        self.write('Hello %s' % self._current_user)

app = Application([
    (r'/', MainHandler),
])

app.listen(8888)
tornado.ioloop.IOLoop.current().start()

# curl --digest user1:pass1 -v http://localhost:8888  -> 200 OK
# curl --digest user2:pass2 -v http://localhost:8888  -> 401 Unauthorized

License

This project is released under the terms of the Apache License, Version 2.0.

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

tornado-http-auth-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tornado_http_auth-0.0.1-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tornado-http-auth-0.0.1.tar.gz.

File metadata

File hashes

Hashes for tornado-http-auth-0.0.1.tar.gz
Algorithm Hash digest
SHA256 01ccbc81f0a0cc08c49373d9a85d26c035eb591c464f126cd2f685c72ff34c14
MD5 bcdc690eac03824fe3844d910c4d0c8a
BLAKE2b-256 db77784c8af8cbd5f93480660c90a23f6fbc7ecefd81755cdf6d16193b28cd74

See more details on using hashes here.

File details

Details for the file tornado_http_auth-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tornado_http_auth-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f7bbd9862cc7f455541decf549a943877625d99ac9b9eb1724fcdb96d25b5e8c
MD5 3bd429cc595932a5bfd5bf94d9695e58
BLAKE2b-256 907bf8a4df4a8f2ce65e217cf3060bff95847cda52f08a9628970480fe02ce36

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