Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing Single Sign On (SSO) using Django [closed]

I would like to use Django for implementing Single Sign On (SSO) for multiple applications that we currently use. How can I implement this using Django?

like image 858
tomrs Avatar asked Jan 11 '11 20:01

tomrs


People also ask

How does django authentication work?

The Django authentication system handles both authentication and authorization. Briefly, authentication verifies a user is who they claim to be, and authorization determines what an authenticated user is allowed to do. Here the term authentication is used to refer to both tasks.

How do you integrate a Keycloak in django?

Setup. Some settings are always required and some other settings are dependant on how you want to integrate Keycloak in your project. Add django-keycloak to your installed apps, add the authentication back-end, add the middleware, configure the urls and point to the correct login page.

How do I sign into Google with django?

In many developer websites, we get to see Google social authentication which is very handy. In this article, we will see how to create a Django Google login project. First, go to https://console.cloud.google.com/apis/dashboardand create a project . Go to Oauth consent screen and create a screen and save & continue.


8 Answers

We're using OpenAM. http://forgerock.com/openam.html

The OpenAM Cookie means that the user is authenticated.

An authentication backend for this is pretty simple. Under 50 lines of code.

https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#other-authentication-sources

We wrote a little bit of code that makes a RESTful request to the OpenAM server to get the user, group and role information. We then use the roles to determine the user's authorizations.

like image 175
S.Lott Avatar answered Oct 05 '22 05:10

S.Lott


MamaCAS appears to be a good solution. (It has gained 104 stars at the time of writing.)

https://github.com/jbittel/django-mama-cas

MamaCAS is a Django Central Authentication Service (CAS) single sign-on and single logout server. It implements the CAS 1.0, 2.0 and 3.0 protocols, including some of the optional features.

CAS is a single sign-on and single logout web protocol that allows a user to access multiple applications after providing their credentials a single time. It utilizes security tickets, unique text strings generated and validated by the server, allowing applications to authenticate a user without direct access to the user's credentials (typically a user ID and password).

like image 44
Rockallite Avatar answered Oct 05 '22 03:10

Rockallite


Take a look at django-cas-provider + django-cas-consumer (or django-cas)

like image 23
Mikhail Korobov Avatar answered Oct 05 '22 05:10

Mikhail Korobov


django-sso is a pretty neat package that implements single signon

like image 39
karthikr Avatar answered Oct 05 '22 05:10

karthikr


Django Simple SSO is another one.

https://github.com/aldryn/django-simple-sso

article about how to use this repo a article

like image 28
nu everest Avatar answered Oct 05 '22 05:10

nu everest


You may implement SSO as follows:

  • Shibboleth as Identity Provider
  • Django website as Service Provider

I've just finished writing detailed guide on my blog: http://codeinpython.blogspot.com/2015/11/how-to-setup-shibboleth-identity.html

like image 26
Sergey Avatar answered Oct 05 '22 05:10

Sergey


CAS (Central Authentication Service) is a good solution that supports SSO (Single Sign-On) and Single Logout (SLO) for Django and Flask. Here is a setup instruction to have a CAS server and multiple clients with the same login/logout:

  1. A CAS-Client is needed so I used the new generation of Django-CAS called django-cas-ng package and here is its configuration to make your own client. (Also, here is a pre-configured client repo)
  2. A CAS-Server is needed so I used a pre-configured repo.

[NOTE]:

  • It supports Django 1.11, 2.x, 3.x

[UPDATE]:

  • It's also worth mentioning that, you have to change the default clients' SESSION_COOKIE_NAME in order to make distinguishable sessions to avoid conflicts at login/logout. In Django, you should add the following line in the settings.py for each Django client:
SESSION_COOKIE_NAME = 'client1_sess'
like image 24
Benyamin Jafari Avatar answered Oct 05 '22 05:10

Benyamin Jafari


I have used https://github.com/onelogin/python3-saml with Azure AD and Google–pretty simple setup with great docs and support.

like image 20
aedry Avatar answered Oct 05 '22 04:10

aedry