Ugly single sign-on for django projects only

Related tags

Djangodjango-usso
Overview

django-usso

Ugly single sign-on for django projects only. Do you have many django apps with different users? Do you want to use only one of those apps for authentication? So I have an easy (and ugly) solution for you! I say it is ugly because it is using a direct DB connection and that is not the best approach, but it works great.

Considerations:

  • The users database is never written
  • last_login value is updated in your current application instead of that one storing the users.
  • Authenticated users are replicated locally with an unusable password
  • groups are replicated too if you set CLONE_GROUPS as True. You can modify the permissions related to those groups locally and those will not be overrwritten.

Installation:

  1. Add usso to your INSTALLED_APPS
  2. Define AUTHENTICATION_BACKENDS in settings:
AUTHENTICATION_BACKENDS = [
    'usso.authentication.UssoModelBackend',
]
  1. Modify your DATABASES dictionary by adding a new connection for users. It has to be a connection to another django project database. We will use it as source of users and groups! For instance:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydb',
        'USER': 'myuser',
        'HOST': 'myhost',
        'PORT': '5432',
        'PASSWORD': 'mypassword',
    },
    'users': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'users_db',
        'USER': 'users_user',
        'HOST': 'users_host',
        'PORT': '5432',
        'PASSWORD': 'users_password',
    },
}
  1. Add USSO_SETTINGS to your settings:
USSO_SETTINGS = {
    'CLONE_GROUPS': True,  # It replicates external groups locally. Default True.
    'AUTH_USER_FIELD': 'username',  # It can be 'email' or 'username'. Default username.
    'USERS_DATABASE_NAME': 'users'  # The extra database name that you added to DATABASES
}
Owner
Erwin Feser
Erwin Feser
Analytics services for Django projects

django-analytical The django-analytical application integrates analytics services into a Django project. Using an analytics service with a Django proj

Jazzband 1.1k Dec 31, 2022
Template de desarrollo Django

Template de desarrollo Django Python Django Docker Postgres Nginx CI/CD DescripciĆ³n del proyecto : Proyecto template de directrices para la estandariz

Diego Esteban 1 Feb 25, 2022
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

2.2k Dec 31, 2022
An airlines clone website with django

abc_airlines is a clone website of an airlines system the way it works is that first you add flights to the website then the users can search flights

milad 1 Nov 16, 2021
A BitField extension for Django Models

django-bitfield Provides a BitField like class (using a BigIntegerField) for your Django models. (If you're upgrading from a version before 1.2 the AP

DISQUS 361 Dec 22, 2022
Backend with Django .

BackendCode - Cookies Documentation: https://docs.djangoproject.com/fr/3.2/intro/ By @tcotidiane33 & @yaya Models Premium class Pack(models.Model): n

just to do it 1 Jan 28, 2022
This is a personal django website for forum posts

Django Web Forum This is a personal django website for forum posts It includes login, registration and forum posts with date time. Tech / Framework us

5 May 12, 2022
Use heroicons in your Django and Jinja templates.

heroicons Use heroicons in your Django and Jinja templates. Requirements Python 3.6 to 3.9 supported. Django 2.2 to 3.2 supported. Are your tests slow

Adam Johnson 52 Dec 14, 2022
Hotwired/Turbo Django response helpers

This package provides helpers for server-side rendering of Hotwired/Turbo streams and frames. Disclaimer: the Hotwired/Turbo client libraries are, at

Hotwire for Django 66 Apr 07, 2022
Django React Flight Rezervation

Django Intro & Installation python -m venv venv source ./venv/Scripts/activate pip install Django pip install djangorestframework pip install python-d

HILMI SARIOGLU 2 May 26, 2022
DRF_commands is a Django package that helps you to create django rest framework endpoints faster using manage.py.

DRF_commands is a Django package that helps you to create django rest framework endpoints faster using manage.py.

Mokrani Yacine 2 Sep 28, 2022
A UUIDField for Django

django-uuidfield Provides a UUIDField for your Django models. Installation Install it with pip (or easy_install): pip install django-uuidfield Usage

David Cramer 265 Nov 30, 2022
Show how the redis works with Python (Django).

Redis Leaderboard Python (Django) Show how the redis works with Python (Django). Try it out deploying on Heroku (See notes: How to run on Google Cloud

Tom Xu 4 Nov 16, 2021
Per object permissions for Django

django-guardian django-guardian is an implementation of per object permissions [1] on top of Django's authorization backend Documentation Online docum

3.3k Jan 04, 2023
A Blog Management System Built with django

Blog Management System Backend use: Django Features Enhanced Ui

Vishal Goswami 1 Dec 06, 2021
Django + NextJS + Tailwind Boilerplate

django + NextJS + Tailwind Boilerplate About A Django project boilerplate/templa

Shayan Debroy 3 Mar 11, 2022
Tools to easily create permissioned CRUD endpoints in graphene-django.

graphene-django-plus Tools to easily create permissioned CRUD endpoints in graphene-django. Install pip install graphene-django-plus To make use of ev

Zerosoft 74 Aug 09, 2022
GeoDjango provides geospatial extensions to the Django web dev framework

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. All documentation is in the "docs" directo

Paul Smith 20 Sep 20, 2022
Django web apps for managing schedules.

skdue Description Skdue is a web application that makes your life easier by helping you manage your schedule. With the ability which allows you to cre

Patkamon_Awai 1 Jun 30, 2022
An app that allows you to add recipes from the dashboard made using DJango, JQuery, JScript and HTMl.

An app that allows you to add recipes from the dashboard. Then visitors filter based on different categories also each ingredient has a unique page with their related recipes.

Pablo Sagredo 1 Jan 31, 2022