Django sso client package for Kodland
Project description
Для работы пакета нужен установленный RabbitMQ.
Обмен с сервером идет через очереди.
После установки
Добавить приложение в список INSTALLED_APPS проекта:
INSTALLED_APPS = [
...
'sso_client'
]
Выполнить миграции:
python manage.py migrate
Добавить в settings.py следующие строки:
import os
import pika
# settings for sso login
AUTH_USER_MODEL = 'sso_client.OauthUser'
AUTHENTICATION_BACKENDS = ('sso_client.backends.TokenAuth', )
SSO_URL = '{адрес sso сервера}/sso/'
LOGIN_URL = '{адрес на sso сервере для логина}'
# корневой домен для cookies
SESSION_COOKIE_DOMAIN = '.local'
JWT_SECRET = os.environ.get('JWT_SECRET')
# если установить в True, то общение с sso сервером авторизации
# для получения данных пользователя будет через RabbitMQ
RABBIT_ON = False
RABBIT_PARAMS = {
'host': os.environ.get('RABBIT_HOST', 'localhost'),
'port': os.environ.get('RABBIT_PORT', 5672),
'credentials': pika.PlainCredentials(os.environ.get('RABBIT_USER', 'guest'), os.environ.get('RABBIT_PASSWORD', 'guest'))
}
Добавить в секцию middleware:
'sso_client.middleware.CheckTokenMiddleware',
'sso_client.middleware.AuthMiddleware'
Project details
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
File details
Details for the file kodland_sso_client-0.2.2.tar.gz
.
File metadata
- Download URL: kodland_sso_client-0.2.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ed7349fdc40c4583362ce2b52e9f7ae5582582e338642a8a18fa871bc0e24f |
|
MD5 | 1a69031674b336d65e7e92fa67aa5fbe |
|
BLAKE2b-256 | 154d0e958e152af1b980c62dbc2890965a754afca3293847aaebe39a375b81c0 |
File details
Details for the file kodland_sso_client-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: kodland_sso_client-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6bcd06804a78db500eb2c2adc78c831c1a2c8bf9ec82211e14b3cf0723109f3 |
|
MD5 | 0f526827544ed11956760dfc5cb11bcb |
|
BLAKE2b-256 | 3551daebec20c7230df7e8a12ba3ef6a70a708f85c5c5072a196f6ee1692743a |