Implements RFC 7804 Salted Challenge Response (SCRAM) HTTP Authentication Mechanism for the Flask web framework.
Reason this release was yanked:
Broken release
Project description
flask-scram
Implements RFC 7804 Salted Challenge Response (SCRAM) HTTP Authentication Mechanism for the Flask web framework.
See requests-scram for a client-side implementation.
Getting Started
Initialize the extension with the application or with init_app
in an application factory, and then decorate your
route with the login_required
method:
from flask import Flask
from flask_scram import Scram
USERNAME = 'user'
PASSWORD = 'pass'
app = Flask(__name__)
db = {}
def auth_fn(username):
return db[username]
scram = ScramAuth(app, auth_fn=auth_fn)
# or, later in your application factory: scram.init_app(app)
# store your authentication key in your "database"
db[USERNAME] = scram.make_auth_info(PASSWORD)
@app.route("/")
@scram.login_required
def index():
return "OK"
You may specify the following configuration variables:
SCRAM_MECHANISM
- supported SCRAM Authentication mechanism e.g.SCRAM-SHA-256
SCRAM_REALM
- the realm parameter to use e.g. defaults torequest.host
You may also use the authenticate
method in your code or before request handler.
See scramp for examples of the make_auth_info
and
make_stored_server_keys
functions which the same methods implement.
Todo
- Implement One Round-Trip Reauthentication
License
Licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flask-scram-1.0.0.tar.gz
.
File metadata
- Download URL: flask-scram-1.0.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.31.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60320bcb0aae3ef6f77284fc3d4839c45ef082cf18d14b6699e1c7eaa9685e72 |
|
MD5 | cfb7faba71933313e9d6464dc7600567 |
|
BLAKE2b-256 | 89c8d99e46df4dced5ee14dce5342532891c5cc2bce3a3f544ddf5dc685da161 |
File details
Details for the file flask_scram-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: flask_scram-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.31.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a0ed1562c7420ee73d66185774261506875b655cc1b654921e2b17b16f39972 |
|
MD5 | b981938c985584afefa4ccab9416a677 |
|
BLAKE2b-256 | 97b2af79cd02f3c081487991979c05711408782b8de7afe3715a498e6853d8aa |