A Flask extension that provides PASETO (Platform-Agnostic Security Token).
Project description
Flask PASETO Extended
Flask-PASETO-Extended is a Flask extension to use PASETO (Platform-Agnostic Security Tokens).
It is built on top of PySETO which is a PASETO implementation
and supports all of PASETO versions (v4
, v3
, v2
and v1
) and purposes (local
and public
).
Currently, we provide the following classes for using PASETO with Flask.
PasetoCookieSessionInterface
: Flask stores session information as a Cookie value. By using this class, you can serialize the session information as an encrypted PASETO.PasetoLoginManager
: By using this class together with Flask-Login, you can use PASETO for remember-me tokens which is also encoded into a Cookie value.PasetoManager
: This class can be used for verifying public (signed) PASETO. It is suitable for using PASETO as API tokens.
Installation
You can install Flask-PASETO-Extended with pip:
$ pip install flask-paseto-extended
Usage
Flask-PASETO-Extended provides three classes for each purpose.
PasetoCookieSessionInterface
This class can be used as follows:
import flask
from flask_paseto_extended import PasetoCookieSessionInterface
app = flask.Flask(__name__)
app.secret_key = 'super secret string'
# Use PASETO("v4" by default) for cookie sessions as follows:
app.session_interface = PasetoCookieSessionInterface()
See examples/cookie_session.py for a sample code that actually works.
PasetoLoginManager
This class can be used as follows:
import flask
import flask_login
from flask_paseto_extended import PasetoLoginManager
app = flask.Flask(__name__)
app.secret_key = 'super secret string'
login_manager = PasetoLoginManager(app)
See examples/login_manager.py for a sample code that actually works.
PasetoManager
T.B.D.
Contributing
We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.
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 Distributions
Built Distribution
Hashes for flask_paseto_extended-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d29ee9bba7ab302b8857037629ede6cee662cdd3951c8d7c2d8f8c0da73c2c08 |
|
MD5 | 25a4f978946a859876fcf47b23385ac2 |
|
BLAKE2b-256 | f278fc3d2642d9a0f39d3214cfe45824bc6edfcdc6b99ed2c9506425c1d30917 |