|
|
|
@ -2,7 +2,7 @@ Introduction
|
|
|
|
|
============
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*Flask-Digest-Auth* is an `HTTP Digest Authentication`_ implementation
|
|
|
|
|
*Flask-DigestAuth* is an `HTTP Digest Authentication`_ implementation
|
|
|
|
|
for Flask_ applications. It authenticates the user for the protected
|
|
|
|
|
views.
|
|
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ own challenge-response log in form, but then you are reinventing the
|
|
|
|
|
wheels. If a pretty log in form is not critical to your project, HTTP
|
|
|
|
|
Digest Authentication should be a good choice.
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth works with Flask-Login_. Log in protection can be
|
|
|
|
|
Flask-DigestAuth works with Flask-Login_. Log in protection can be
|
|
|
|
|
separated with the authentication mechanism. You can create protected
|
|
|
|
|
Flask modules without knowing the actual authentication mechanisms.
|
|
|
|
|
|
|
|
|
@ -32,18 +32,18 @@ Flask modules without knowing the actual authentication mechanisms.
|
|
|
|
|
Installation
|
|
|
|
|
------------
|
|
|
|
|
|
|
|
|
|
You can install Flask-Digest-Auth with ``pip``:
|
|
|
|
|
You can install Flask-DigestAuth with ``pip``:
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
pip install Flask-Digest-Auth
|
|
|
|
|
pip install Flask-DigestAuth
|
|
|
|
|
|
|
|
|
|
You may also install the latest source from the
|
|
|
|
|
`Flask-Digest-Auth GitHub repository`_.
|
|
|
|
|
`Flask-DigestAuth GitHub repository`_.
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
pip install git+https://github.com/imacat/flask-digest-auth.git
|
|
|
|
|
pip install git+https://github.com/imacat/flask-digestauth.git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting the Password
|
|
|
|
@ -66,10 +66,10 @@ hash.
|
|
|
|
|
See :func:`flask_digest_auth.algo.make_password_hash`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth Alone
|
|
|
|
|
-----------------------
|
|
|
|
|
Flask-DigestAuth Alone
|
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth can authenticate the users alone.
|
|
|
|
|
Flask-DigestAuth can authenticate the users alone.
|
|
|
|
|
|
|
|
|
|
See :ref:`example-alone-simple` and :ref:`example-alone-large`.
|
|
|
|
|
|
|
|
|
@ -77,12 +77,12 @@ See :ref:`example-alone-simple` and :ref:`example-alone-large`.
|
|
|
|
|
Flask-Login Integration
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth works with Flask-Login_. You can write a Flask
|
|
|
|
|
Flask-DigestAuth works with Flask-Login_. You can write a Flask
|
|
|
|
|
module that requires log in, without specifying how to log in. The
|
|
|
|
|
application can use either HTTP Digest Authentication, or the log in
|
|
|
|
|
forms, as needed.
|
|
|
|
|
|
|
|
|
|
To use Flask-Login with Flask-Digest-Auth,
|
|
|
|
|
To use Flask-Login with Flask-DigestAuth,
|
|
|
|
|
``login_manager.init_app(app)`` must be called before
|
|
|
|
|
``auth.init_app(app)``.
|
|
|
|
|
|
|
|
|
@ -92,7 +92,7 @@ The currently logged-in user can be retrieved at
|
|
|
|
|
See :ref:`example-flask-login-simple` and
|
|
|
|
|
:ref:`example-flask-login-large`.
|
|
|
|
|
|
|
|
|
|
The views only depend on Flask-Login, but not the Flask-Digest-Auth.
|
|
|
|
|
The views only depend on Flask-Login, but not the Flask-DigestAuth.
|
|
|
|
|
You can change the actual authentication mechanism without changing
|
|
|
|
|
the views.
|
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ the views.
|
|
|
|
|
Session Integration
|
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth features session integration. The user log in
|
|
|
|
|
Flask-DigestAuth features session integration. The user log in
|
|
|
|
|
is remembered in the session. The authentication information is not
|
|
|
|
|
requested again. This is different to the practice of the HTTP Digest
|
|
|
|
|
Authentication, but is convenient for the log in accounting.
|
|
|
|
@ -124,7 +124,7 @@ See :meth:`flask_digest_auth.auth.DigestAuth.register_on_login`.
|
|
|
|
|
Log Out
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth supports log out. The user will be prompted for the
|
|
|
|
|
Flask-DigestAuth supports log out. The user will be prompted for the
|
|
|
|
|
new username and password.
|
|
|
|
|
|
|
|
|
|
See :meth:`flask_digest_auth.auth.DigestAuth.logout`.
|
|
|
|
@ -133,7 +133,7 @@ See :meth:`flask_digest_auth.auth.DigestAuth.logout`.
|
|
|
|
|
Test Client
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
Flask-Digest-Auth comes with a test client that supports HTTP digest
|
|
|
|
|
Flask-DigestAuth comes with a test client that supports HTTP digest
|
|
|
|
|
authentication.
|
|
|
|
|
|
|
|
|
|
See :class:`flask_digest_auth.test.Client`.
|
|
|
|
@ -145,4 +145,4 @@ Also see :ref:`example-unittest` and :ref:`example-pytest`.
|
|
|
|
|
.. _RFC 2617: https://www.rfc-editor.org/rfc/rfc2617
|
|
|
|
|
.. _Flask: https://flask.palletsprojects.com
|
|
|
|
|
.. _Flask-Login: https://flask-login.readthedocs.io
|
|
|
|
|
.. _Flask-Digest-Auth GitHub repository: https://github.com/imacat/flask-digest-auth
|
|
|
|
|
.. _Flask-DigestAuth GitHub repository: https://github.com/imacat/flask-digestauth
|
|
|
|
|