Skip to main content

Module for use ksu sso service

Project description

Настройка

В settings проекта добавить:

  • 'sso_auth' в INSTALLED_APPS
    После этого выполнить команды
python3 manage.py makemigrations sso_auth
python3 manage.py migrate

Добавить в urls.py проекта в переменную urlpatterns выше всего остального следующий код:

path('admin/login/', AdminLogin.as_view()),
path('admin/logout/', UserLogout.as_view()),
path('sso/', include('sso_auth.urls')),

До этого сделать импорт:

from django.urls import path, include
from sso_auth.views import AdminLogin, UserLogout

В settings проекта добавить:

  • 'sso_auth.middleware.OauthMiddleware' в MIDDLEWARE
  • код ниже. нужно заполнить реальными данными от сервера авторизации
# settings for sso login
AUTH_USER_MODEL = 'sso_auth.OauthUser'
AUTHENTICATION_BACKENDS = ('sso_auth.backends.TokenAuth', 'django.contrib.auth.backends.ModelBackend')
SSO_URL = 'http://127.0.0.1:8000/oauth/'
CLIENT_ID = '1bc2aea0-4dad-4f4a-9f3d-4e205b0fc10a'
CLIENT_SECRET = 'Zo8DtoPgu6m533ySFDfBImo0Lao_sh50dxE-EAHJCkwCrNvaPztIsOQaxdB0nKrX11o'
REDIRECT_URI = 'http://127.0.0.1:8001/sso/process'

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

ksu_sso_auth-0.0.7.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

ksu_sso_auth-0.0.7-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page