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.0.0a3.tar.gz
(14.8 kB
view hashes)
Built Distribution
Close
Hashes for qotto-auth-client-2.0.0a3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d93f26d8f2af72d960f136799ee99edbcaf1bfdb484c3c57691fa7009579752 |
|
MD5 | a8951e1b8b375702f04e8de42a7c252e |
|
BLAKE2b-256 | 2e553398effbc0d0788efc8cd32c2a791dd432b8aee8a457023ee38c5f621dc2 |
Close
Hashes for qotto_auth_client-2.0.0a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b47904241b1cb547c7ad0841262787eec7d12182e925f91d4c287b432970dd8 |
|
MD5 | 7b6dfd23596f4a30ebc025a71734755c |
|
BLAKE2b-256 | 0cf27bbbda642b8b31472ce3892269192755c4255b750ee56a5d23a8dcb642bd |