A simple SSO UI CAS wrapper for Django
Project description
django-sso-ui
Sebuah library python untuk memudahkan aplikasi django menggunakan SSO Universitas Indonesia.
Instalasi
pip install django-sso-ui
Cara Menggunakan
Pertama import decorator with_sso_ui
from django_sso_ui.decorators import with_sso_ui
Lalu wrap ke view yang membutuhkan info user sso ui. Jangan lupa tambahkan parameter sso_profile
pada fungsi view yang di wrap.
@with_sso_ui
def login(request, sso_profile):
return HttpResponse(json.dumps(sso_profile))
Apabila pengguna tidak diharuskan login dengan SSO untuk mengakses view tersebut, tambahkan parameter force_login=False
pada decorator.
@with_sso_ui(force_login=False)
def login(request, sso_profile):
return HttpResponse(json.dumps(sso_profile))
Settings
Untuk mengubah endpoint cas yang digunakan, terdapat opsi di tambahkan
line berikut di settings.py
dengan endpoint yang diinginkan
SSO_UI_URL="https://sso.ui.ac.id/cas2/"
Untuk memaksa library untuk menggunakan https
untuk url callback setelah
login CAS berhasil, tambahkan line berikut di settings.py
SSO_UI_FORCE_SERVICE_HTTPS=True
Notes
Informasi tambahan seperti fakultas, study_program hanya bisa didapatkan
apabila menggunakan https://sso.ui.ac.id/cas2
.
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 Distributions
Built Distribution
Hashes for django_sso_ui-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec33a8dc6c77ce2ae5096f0ff292a9605404ce596f76c4140bcb3e22f981f71 |
|
MD5 | 236dba02ef3b68498774e7b0fc4a00fd |
|
BLAKE2b-256 | aa080e52b1d936232882cea7a3a6b62f5b4e1932cfc3dc98c7e928f43b6526d2 |