Strong, Simple, (now async!) and Precise security for Sanic APIs
Project description
sanic-beskar
Stable branch: master
CBTE (coding by trial and error) branch: dev
Working example(s): examples/*.py
Strong, Simple, and Precise security for Sanic APIs
This project’s begining was fully lifted from the awesome Flask-Praetorian.
Why beskar? Why not – what is better than star wars (provided you ignore the fact ~the mandolorian~ was almost as lame as ~book of boba fett~)? Superior armour should be used if you want superior protection.
This package aims to provide that. Using token implemented by either PySETO or PyJWT, sanic-beskar uses a very simple interface to make sure that the users accessing your API’s endpoints are provisioned with the correct roles for access.
The goal of this project is to offer simplistic protection, without forcing nonsense, excessivly complicatated implimentation, or mandated/opinionated ORM usage. Providing this usability for small scaled Sanic applications, while allowing the flexibility and scalability for enterprise grade solutions, seperates this from your other options.
The sanic-beskar package can be used to:
Hash passwords for storing in your database
Verify plaintext passwords against the hashed, stored versions
Generate authorization tokens upon verification of passwords
Check requests to secured endpoints for authorized tokens
Supply expiration of tokens and mechanisms for refreshing them
Ensure that the users associated with tokens have necessary roles for access
Parse user information from request headers for use in client route handlers
Support inclusion of custom user claims in tokens
Register new users using email verification
Support OTP authentication as a dual factor
Provide RBAC based protection of endpoints and resources
All of this is provided in a very simple to configure and initialize flask extension. Though simple, the security provided by sanic-beskar is strong due to the usage of the proven security technology of PASETO or JWT, along with python’s PassLib package.
Super-quick Start
requirements: python versions 3.7+
install through pip: $ pip install sanic-beskar
minimal usage example: example/basic.py
Documentation
The complete documentation can be found at the sanic-beskar home page
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sanic_beskar-2.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 745c4c74b49fa3ac142a1bd31f88b2918aff710a655da677e912ce056e4697c5 |
|
MD5 | 47e8538451059edd3b13c43886090694 |
|
BLAKE2b-256 | 05ad82325caca9e11dad26601c1f4b535003f927ae350a542bf9447c1f05ea5d |