Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

flask_paseto_extended-0.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file flask_paseto_extended-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: flask_paseto_extended-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for flask_paseto_extended-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d29ee9bba7ab302b8857037629ede6cee662cdd3951c8d7c2d8f8c0da73c2c08
MD5 25a4f978946a859876fcf47b23385ac2
BLAKE2b-256 f278fc3d2642d9a0f39d3214cfe45824bc6edfcdc6b99ed2c9506425c1d30917

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