{ "info": { "author": "Victor Andrade de Almeida", "author_email": "vct.a.almeida@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Flask", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: Implementation" ], "description": "#############################\nFlask Digest |license| |pypi|\n#############################\n\n.. |license| image:: https://img.shields.io/pypi/l/Flask-Digest.svg?style=flat-square\n :target: https://github.com/vctandrade/flask-digest/blob/master/LICENSE.txt\n\n.. |pypi| image:: https://img.shields.io/pypi/v/Flask-Digest.svg?style=flat-square\n :target: https://pypi.python.org/pypi/Flask-Digest\n\nFlask Digest provides a RESTful way of authenticating users using a Flask\napplication. To achieve that, it uses the Digest Access Authentication protocol\nand most optional features described in `RFC 2617`_.\n\nIn a simplified manner, Flask Digest allows you to make your resources available\nonly to those registered in your system, while taking care of security issues by\nfollowing well known protocols.\n\n.. _RFC 2617: https://www.ietf.org/rfc/rfc2617.txt\n\nQuick start\n===========\n\nFirst of all, installation is as simple as:\n\n.. code-block:: console\n\n $ pip install flask-digest\n\nAfter doing that, it's important to note this module is\nimplementation-independent of how the user database is handled and accessed. So\nthe first thing you need to do is set that up, including methods for registering\nusers and accessing their passwords.\n\nThen, you need to create a ``Stomach`` object and inform it of how to use the\ndatabase you created. The only thing left now is to decide which resources\nshould be protected and mark them accordingly.\n\nAll the steps regarding the ``Stomach`` object are done with the use of three\ndecorator methods, similar to the ones used by Flask. Those are exemplified\nbellow, where ``myRealm`` is a string of your choosing, used to describe and\nidentify your server in a unique fashion:\n\n.. code-block:: python\n\n from flask import Flask\n from flask_digest import Stomach\n\n app = Flask(__name__)\n stomach = Stomach('myRealm')\n\n db = dict()\n\n @stomach.register\n def add_user(username, password):\n db[username] = password\n\n @stomach.access\n def get_user(username):\n return db.get(username, None)\n\n @app.route('/')\n @stomach.protect\n def main():\n return '