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

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

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page