ahopkins / sanic-jwt

Authentication, JWT, and permission scoping for Sanic
http://sanic-jwt.readthedocs.io
MIT License
242 stars 52 forks source link

Add support for Fernet encryption of the Payload #186

Closed cr0hn closed 4 years ago

cr0hn commented 4 years ago

Goal

Added support of Fernet encryption of the Payload

Approach

Add new authentication class that implements this feature

New Features/Changes

Encryption by using Fernet. The rest of the features of project are unmodified and runs oks

Example

    from sanic import Sanic
    from sanic_jwt import AuthenticationEncrypted, Initialize

    app = Sanic()
    app.config.ENCRYPT_PASSWORD = "ASDFAsdfkjalsdfjlkasdfjlkasdjflksaKSKSKS"
    app.config.ENCRYPT_SALT = "ASDFAsdfkjalsdfjlkasdfjlkasdjflksa"  # This is optional

    Initialize(app, authentication_class= AuthenticationEncrypted)

Open Questions and TODOs