A set of views, backends for authorization with SSO
-
Install the package
pip install git+https://git2.devebs.net/ebs-platform/drf-ebs-sso.git
-
Change Authentication in Django Rest Framework settings
REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'drf_ebs_sso.backends.SSOAuthentication', ) }
-
Add in settings the SSO settings:
SSO_DOMAIN = 'http://ebs-sso-host-example.com/' SSO_SERVICE_TOKEN = "ebs-sso-secret-example"
-
If you use Django ORM and standard User model skip this step.
If you use custom model set the default model:
AUTH_USER_MODEL = 'users.User'
If you use MongoEngine document set:
AUTH_USER_DOCUMENT = 'apps.users.models.User'
-
Set the desired views
from drf_ebs_sso.views import ( AuthUser, ConfirmUserPassword, RestoreUserPassword, ChangePassword, RefreshToken, FirebaseCheck ) urlpatterns = [ path("login", AuthUser.as_view(), name="users_login"), path("confirm-restore-password", ConfirmUserPassword.as_view()), path("restore-password", RestoreUserPassword.as_view()), path("change-password", ChangePassword.as_view()), path("refresh", RefreshToken.as_view()), path("firebase-check", FirebaseCheck.as_view()), ]
-
Enjoy!