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.2.4a0.tar.gz
(19.0 kB
view hashes)
Built Distribution
Close
Hashes for qotto_auth_client-2.2.4a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73f18c1719cfddfef80996c6b2320703d8ca823b8a296db9d94d84fdb2a146df |
|
MD5 | a7082ce9d06e7f288b10ed0eb584f2b4 |
|
BLAKE2b-256 | 137df662fda1119c653286e382f3faa8e6d7cd2207a42a48f15777720a8982d9 |
Close
Hashes for qotto_auth_client-2.2.4a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa373a72482d0e2102e5550ffb149b12bc0f1ddaba9b170b5d095d1794ce62a4 |
|
MD5 | 0074fb6a7ba30a0959fcff82e77fc597 |
|
BLAKE2b-256 | 995733c1e64bf190dc41dd82182125e776f1e78ffdbe4e895f6c5d315036e4bd |