Skip to main content

Falcon signed sessions

This project allows you to easily add trusted cookies to falcon, it works by storing a signed cookie in the client's browser using itsdangerous what we call a session. If the cookie is edited the data won't be loaded into the session context. If you don't store the secret key & salt somewhere secure (like a env file) then the session data will be invalidated between restarts.

How it works

  • Use req.context.get_session(key) to read session data, None if doesn't exist.
  • Use req.context.sessions() to read all sessions.
  • Use resp.context.set_session(key, value) to edit session data & sign for client.

Install

pip3 install FalconSignedSessions

How to use

import secrets
from FalconSignedSessions import SignedSessions


app = falcon.App()
app.add_middleware(
    SignedSessions(
        secret_key=secrets.token_urlsafe(24),
        salt=secrets.token_bytes(),
        session_cookie="session"
    )
)


class SessionResource:
    def on_get(self, req: Request, resp: Response) -> None:
        # Get all sessions as dict.
        print(req.context.sessions())

        # Used to get a session
        print(req.context.get_session("trusted"))

        # Set a session.
        resp.context.set_session("trusted", True)


app.add_route("/cookies", SessionResource())

Metadata

Release files for FalconSignedSessions 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FalconSignedSessions 0.0.3
File Size Uploaded Provenance Actions
FalconSignedSessions-0.0.3.tar.gz 16.2 kB Without provenance Details for FalconSignedSessions-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for FalconSignedSessions 0.0.3
File Interpreter ABI Platform Actions
FalconSignedSessions-0.0.3-py3-none-any.whl Python 3 none any Details for FalconSignedSessions-0.0.3-py3-none-any.whl

Total release size: 32.1 kB

Release files / FalconSignedSessions-0.0.3.tar.gz

Download URL FalconSignedSessions-0.0.3.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cba5c006d423c3ef475ef568cb4c36c25546ecdcce6ef6923df302ca79349f3c
BLAKE2b-256 checksum
How to use checksums
71d2795d72a1536552fe9490918067ae734ce35f969f57e41a007c509dd3eb0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / FalconSignedSessions-0.0.3-py3-none-any.whl

Download URL FalconSignedSessions-0.0.3-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
080e8b5a8950aa6294498e95d180300093baf4b2eed477a88bfadca4de9cd0f3
BLAKE2b-256 checksum
How to use checksums
4753b2025224196897feb9eceb2878dca4f29b72fca2a52cb874ec7bce3b109f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for FalconSignedSessions 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page