Metadata-Version: 2.1
Name: sanic-beskar
Version: 2.2.1
Summary: Strong, Simple, (now async!) and Precise security for Sanic APIs
Home-page: https://sanic-beskar.readthedocs.io/en/latest/
License: MIT
Author: Rob Dailey
Author-email: rob@suspected.org
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: cryptography (>=37.0.4,<38.0.0)
Requires-Dist: passlib (>=1.7,<2.0)
Requires-Dist: pendulum (>=2.1,<3.0)
Requires-Dist: py-buzz (>=3.2.1,<4.0.0)
Requires-Dist: pyjwt (>=2.0,<3.0)
Requires-Dist: pyseto (>=1.6.9,<2.0.0)
Requires-Dist: sanic (>=22.6.0,<23.0.0)
Requires-Dist: sanic-jinja2 (>=2022.1.13,<2023.0.0)
Project-URL: Documentation, https://sanic-beskar.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/pahrohfit/sanic-beskar
Description-Content-Type: text/x-rst

.. image::  https://badge.fury.io/py/sanic-beskar.svg
   :target: https://badge.fury.io/py/sanic-beskar
   :alt:    Latest Published Version

.. image::  https://readthedocs.org/projects/sanic-beskar/badge/?version=latest
   :target: http://sanic-beskar.readthedocs.io/en/latest/?badge=latest
   :alt:    Documentation Build Status

.. image:: https://api.codacy.com/project/badge/Grade/55f9192c1f584ae294bc1642b0fcc70c
   :alt: Codacy Badge
   :target: https://app.codacy.com/gh/pahrohfit/sanic-beskar?utm_source=github.com&utm_medium=referral&utm_content=pahrohfit/sanic-beskar&utm_campaign=Badge_Grade_Settings

.. image:: https://mayhem4api.forallsecure.com/api/v1/api-target/pahrohfit/pahrohfit-sanic-beskar/badge/icon.svg?scm_branch=master
   :alt: Mayhem for API
   :target: https://mayhem4api.forallsecure.com/pahrohfit/pahrohfit-sanic-beskar/latest-job?scm_branch=master

******************
 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 <https://github.com/dusktreader/flask-praetorian>`_.

Why `beskar <https://starwars.fandom.com/wiki/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 <https://pyseto.readthedocs.io/en/latest/>`_ or
`PyJWT <https://pyjwt.readthedocs.io/en/latest/>`_,
*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 <http://pythonhosted.org/passlib/>`_ package.

Super-quick Start
-----------------
 - requirements: `python` versions 3.7+
 - install through pip: `$ pip install sanic-beskar`
 - minimal usage example: `example/basic.py <https://github.com/pahrohfit/sanic-beskar/tree/master/example/basic.py>`_

Documentation
-------------

The complete documentation can be found at the
`sanic-beskar home page <http://sanic-beskar.readthedocs.io>`_

