-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fc7b48
commit 223f457
Showing
6 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include django_sso_ui/additional-info.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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. | ||
|
||
```py | ||
@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. | ||
|
||
```py | ||
@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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pathlib | ||
from setuptools import setup | ||
|
||
# The directory containing this file | ||
HERE = pathlib.Path(__file__).parent | ||
|
||
# The text of the README file | ||
README = (HERE / "README.md").read_text() | ||
|
||
# This call to setup() does all the work | ||
setup( | ||
name="django-sso-ui", | ||
version="1.0.0", | ||
description="A simple SSO UI CAS wrapper for Django", | ||
long_description=README, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/RistekCSUI/django-sso", | ||
author="Fata Nugraha", | ||
author_email="[email protected]", | ||
license="MIT", | ||
classifiers=[ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.6", | ||
], | ||
packages=["django_sso_ui"], | ||
include_package_data=True, | ||
install_requires=["python-cas", "django"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters