{"repo":"aogier/starlette-authlib","free":true,"listed":false,"github":"https://github.com/aogier/starlette-authlib","clone":"git clone https://github.com/aogier/starlette-authlib.git","description":"A drop-in replacement for Starlette session middleware, using Authlib's jwt","language":"Python","stars":77,"topics":["starlette","starlette-middleware","asgi","authlib","jwt-middleware","jwt"],"license":"BSD-3-Clause","category":"auth-billing-email","readme_excerpt":"Starlette Authlib Middleware Introduction A drop-in replacement for Starlette session middleware, using authlib's jwt. Rationale It is sometimes necessary to integrate a Starlette-based application into more complex scenarios where other actors need to make decisions based on session data. This middleware makes this possible by using a standard JWT token instead of the Starlette-encrypted one, thus simplifying interaction with third-party components. Requirements Python 3.10+ Starlette 0.9+ Installation Usage A complete example where we drop-in replace standard session middleware: Other things you can configure either via environment variables or .env file: DOMAIN - declare cookie domain. App must be under this domain. If empty, the cookie is restricted to the subdomain of the app (this is useful when you write eg. SSO portals) JWT ALG - one of authlib JWT supported algorithms JWT SECRET - jwt secret. Only useful for HS algorithms, see the sample app folder for middleware usage w/ crypto keys. See it in action: sample application A sample application is included, and you can run it with either Starlette-based session middleware or this one, just by setting a variable: As you can notice in code here, the only difference is an import name, based on this VANILLA env var. Contributing This project is absolutely open to contributions so if you have a nice idea, create an issue to let the community discuss it.","default_branch":null,"files":null,"tree":[],"storefront":"/r/aogier","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/aogier/starlette-authlib/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}