Qloud Integration for WSGI applications
Project description
Qloud Integration for WSGI Servers
qloud-wsgi
is a WSGI middleware compatible with all frameworks that support WSGI, like
Flask. It provides a simple way to integrate with Qloud.
Installation
pip install qloud-wsgi
Note, we currently only support Python 3.7 and above.
Usage
Flask
from flask import Flask, request
import qloud
SECRET = "YOUR_SECRET"
app = Flask(__name__)
app.wsgi_app = qloud.QloudAuthentication(app.wsgi_app, SECRET, credentials_required=False)
@app.route("/")
def hello_user():
return request.environ.get("auth") or "Hello Anonymous!"
The SECRET
is the secret key that you can find in the Qloud Console Dashboard,
respectively, for the DevAuth environment it's fixed
to 00000000000000000000000000000000
.
The middleware injects the decoded JSON Web Token using the key auth
into the environment of the request (e.g.
environ["auth"]
in plain WSGI, or request.environ.get("auth")
in a Flask app).
Our documentation has all the information of the fields present in the
JWT.
Credentials Required
The credentials_required
parameter is optional and defaults to False
. For requests without a JSON Web Token,
environ["auth"]
will not be set.
If your application uses mandatory authentication, we
recommend to set credentials_required
to True
, the integration itself will then also reject unauthenticated requests
if they bypass the Proxy.
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 qloud_wsgi-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada98de650a4dad6af42db08fe53109a27a4a91489d83c8e4ee6e48a54812272 |
|
MD5 | 1674ebcc0070e979e961fc7bad984ae7 |
|
BLAKE2b-256 | 0562710699f7ad11b74d1046ffad36774f5216c60d574f2738c3aeaa3516d354 |