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.3a0.tar.gz
(18.6 kB
view hashes)
Built Distribution
Close
Hashes for qotto_auth_client-2.2.3a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9102dbb7a11c4abd9a42d3086bbdc8affa97618fd361c5f0681b6dd513b29d99 |
|
MD5 | 34a077e8549e5f6fdf7b222d5243d141 |
|
BLAKE2b-256 | a7f34cc33d419167128a4d7ae6eaaf91c71956cc14ca9d8541e8105aa19b5557 |
Close
Hashes for qotto_auth_client-2.2.3a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfbe7635ba0ff1482f581f684505493868273bbf704b74c36e8cc83411b95179 |
|
MD5 | 5b546ac4b8371421cbc9a219e5582822 |
|
BLAKE2b-256 | a90ad6c7f63d9197ae06da5cc440ae8d3a210720dcb3f3147abd68f8d91202ea |