量潮身份与访问管理Django工具箱
Install the package with pip
.
pip install django-quanttide-idam
Add django_quanttide_idam
to your INSTALLED_APPS
in Django settings.py
.
# settings.py
INSTALLED_APPS = [
...,
'rest_framework',
...,
'django_quanttide_idam',
...
]
修改Auth用户模型
# settings.py
AUTH_USER_MODEL = 'django_quanttide_idam.AuthUser'
修改REST Framework的默认Auth和Permission类
# settings.py
REST_FRAMEWORK = {
...,
'DEFAULT_AUTHENTICATION_CLASSES': [
'django_quanttide_idam.authentication.IDTokenAuthentication',
],
...,
'DEFAULT_PERMISSION_CLASSES': [
'django_quanttide_idam.permissions.IsAdminUserOrIsAuthenticatedReadOnly',
],
}
This package uses Apache 2.0 License