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 beginning 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 implementation, or mandated/opinionated ORM usage. Providing this usability for small scaled Sanic applications, while allowing the flexibility and scalability for enterprise grade solutions, separates 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
Metadata
Release files for sanic-beskar 3.2.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 | |
|---|---|---|---|
| sanic_beskar-3.2.0.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sanic_beskar-3.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.0 kB
Release files / sanic_beskar-3.2.0.tar.gz
| Download URL | sanic_beskar-3.2.0.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b713eedbe4e817695dc8a4752f970628866f0a9b5b744a41b602e20155b7e42
|
|
BLAKE2b-256 checksum How to use checksums |
233db3a8c301e790231f6a149740ed14381d4cd6cd420a786040df8fee0e11cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1015-azure
|
Release files / sanic_beskar-3.2.0-py3-none-any.whl
| Download URL | sanic_beskar-3.2.0-py3-none-any.whl |
|---|---|
| Size | 39.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33d392d9ba47fd17daa9041327d6992271103892bf5ca4951332dd012de080b9
|
|
BLAKE2b-256 checksum How to use checksums |
91a52e8bf598d76f3c56dc753ff791dafe20d5710f5540c46f51ae5789eeaf26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1015-azure
|