Flask-SSS
Server-Side Sessions for Flask implemented as a SessionInterface.
## Data model
The user_id field allows for users to either list their open sessions and close other sessions they have open. It also enables administrators to log out all sessions for a user that needs to be suspended or deleted.
## Usage
from flask import Flask
from flask_sss import SQLAlchemySessionInterface
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, String, DateTime, Text
from datetime import datetime
import uuid
app = Flask(__name__)
db = SQLAlchemy(app)
class UserSession(db.Model):
__tablename__ = "user_session"
id = Column(String(length=255), primary_key=True)
session_id = Column(String(length=255), unique=True)
user_id = Column(String(length=255), nullable=True)
created_at = Column(DateTime(), nullable=False, default=datetime.utcnow)
updated_at = Column(DateTime(), nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
expires_at = Column(DateTime(), nullable=False)
data = Column(Text(), nullable=False)
def make_id():
return str(uuid.uuid4())
app.session_interface = SQLAlchemySessionInterface(
orm_session=db.session,
sql_session_model=UserSession,
make_id=make_id
)
Notes
A daily process to remove expired sessions is recommended to stop the session list expanding over time.
Metadata
Release files for Flask-SSS 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-SSS-0.1.0.tar.gz | 3.9 kB | Without provenance | Details for Flask-SSS-0.1.0.tar.gz |
Release files / Flask-SSS-0.1.0.tar.gz
| Download URL | Flask-SSS-0.1.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5b5bff2fdaa7648622afd291b60013b441a81a97876c9889760a5a0e9d04e1e
|
|
BLAKE2b-256 checksum How to use checksums |
5319d48f5095c666b41ff7a7da040a91bce8fa339021350ed4949c4b69818055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
|
Security for Flask-SSS 0.1.0
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.