API Reference¶
PASETO (Platform-Agnostic Security Tokens) for Flask applications. <https://github.com/dajiaji/flask-paseto-extended>
- class flask_paseto_extended.PasetoCookieSessionInterface(paseto_version: int = 4)[source]¶
Bases:
SessionInterface
- class flask_paseto_extended.PasetoLoginManager(app=None, add_context_processor=True)[source]¶
Bases:
LoginManager
- init_app(app, add_context_processor=True)[source]¶
Configures an application. This registers an after_request call, and attaches this LoginManager to it as app.login_manager.
- Parameters:
app (
flask.Flask
) – Theflask.Flask
object to configure.add_context_processor (bool) – Whether to add a context processor to the app that adds a current_user variable to the template. Defaults to
True
.
- class flask_paseto_extended.PasetoIssuer(app=None, add_context_processor=True)[source]¶
Bases:
object
- class flask_paseto_extended.PasetoVerifier(app=None, add_context_processor=True)[source]¶
Bases:
object
- init_app(app, add_context_processor=True)[source]¶
Configures an Flask application to use this PasetoVerifier.
- property token_loader_callback¶
- property verification_error_handler_callback¶
- class flask_paseto_extended.Token(is_verified: bool, version: str = '', purpose: str = '', payload: bytes | dict = b'', footer: bytes | dict = b'', error: Exception | None = None)[source]¶
Bases:
object
The parsed token object which can be referred as
current_paseto
in the views decorated by@token_required
.- property is_verified: bool¶
If it is
True
, the token has been verified.
- property version: str¶
The version of the token. It will be
"v1"
,"v2"
,"v3"
or"v4"
.
- property purpose: str¶
The purpose of the token. It will be
"local"
or"public"
.
- property header: bytes¶
The header of the token. It will be
"<version>.<type>."
. For example,"v1.local."
.
- property payload: bytes | dict¶
The payload of the token which is a decoded binary string. It’s not Base64 encoded data.
The footer of the token which is a decoded binary string. It’s not Base64 encoded data.
- property error: Exception | None¶
If
is_verified
isTrue
, this property will be specified.
- exception flask_paseto_extended.FlaskPasetoError[source]¶
Bases:
Exception
Base class for all exceptions.
- exception flask_paseto_extended.EncodeError[source]¶
Bases:
FlaskPasetoError
An Exception occurred when a PASETO encoding process failed.
- exception flask_paseto_extended.DecodeError[source]¶
Bases:
FlaskPasetoError
An Exception occurred when a PASETO decoding process failed.