Qotto/QottoAuthClient
Project description
Qotto Auth Client
The python package qotto-auth-client
is a client for the API qotto-auth
which will soon be open sourced.
It allows to manage a scoped permission and authentication system.
More information coming soon...
Quickstart
The QottoAuthService
class allows to interact with a qotto-auth
GraphQL server.
from qottoauth import *
# Initialize the service
qotto_auth_service = QottoAuthService(QottoAuthGqlApi(QOTTO_AUTH_URL))
# Register this application
application = qotto_auth_service.register_application(
name=APPLICATION_NAME,
description=APPLICATION_DESCRIPTION,
)
# Register permission
permission_1 = qotto_auth_service.register_permission(
name=PERMISSION_1_NAME,
description=PERMISSION_1_DESCRIPTION,
application=application,
)
# Fetch current user or member
def handle(request)
actor = qotto_auth_service.actor(
token=request.COOKIES.get(TOKEN_COOKIE_NAME),
secret=request.COOKIES.get(SECRET_COOKIE_NAME),
)
if qotto_auth_service.is_authorized(
actor=actor,
permission=permission_1,
):
# Do something
else:
# Do something else
You can instantiate a QottoAuthService
with a QottoAuthTestApi
for testing purposes. In that case you might want to
extend the test api class if you extended service using direct api calls.
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
qotto_auth_client-2.1.6a1.tar.gz
(18.7 kB
view hashes)
Built Distribution
Close
Hashes for qotto_auth_client-2.1.6a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f03fd9adafdbd40b86a53b27c7aa579d109bca0d48825623913b7c53ee80273 |
|
MD5 | 1add78d2451858e8ac01584bc4f58b51 |
|
BLAKE2b-256 | 7a3d9c70af70e57ded599b3a504734c889a44311523c24f53fcad8124234f730 |
Close
Hashes for qotto_auth_client-2.1.6a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f170f78e25402afa623a0ef775d39d76a5ab9cd0998389b9eee37ae2d49835ea |
|
MD5 | 3cea739f34b173c032cb36691a06b7cf |
|
BLAKE2b-256 | 8c466f14239ea6fd7753d0629cd42ab0000ca0ccbc234355af9ee169afd4b99c |