Skip to main content

Easily add Microsoft Authentication to your Django Projects

Project description

Django Microsoft SSO

Easily integrate Microsoft Authentication into your Django projects

PyPI Build PyPI - Python Version PyPI - Django Version

Welcome to Django Microsoft SSO

This library aims to simplify the process of authenticating users with Microsoft in Django Admin pages, inspired by libraries like django_microsoft_auth and django-admin-sso


Documentation


Install

$ pip install django-microsoft-sso

Configure

  1. Add the following to your settings.py INSTALLED_APPS:
# settings.py

INSTALLED_APPS = [
    # other django apps
    "django.contrib.messages",  # Need for Auth messages
    "django_microsoft_sso",  # Add django_microsoft_sso
]
  1. In Microsoft Entra Administration Center at Application Register, retrieve your Application ID. Navigate to Certificate & secrets link, and get the Client Secret Value. Add both in your settings.py:
# settings.py

MICROSOFT_SSO_APPLICATION_ID = "your Application ID here"
MICROSOFT_SSO_CLIENT_SECRET = "your Client Secret Value here"
  1. Add the callback uri http://localhost:8000/microsoft_sso/callback/ in your Microsoft Console, on the "Authorized Redirect URL".

  2. Let Django Microsoft SSO auto create users for allowable domains:

# settings.py

MICROSOFT_SSO_ALLOWABLE_DOMAINS = ["contoso.com"]
  1. In urls.py please add the Django-Microsoft-SSO views:
# urls.py

from django.urls import include, path

urlpatterns = [
    # other urlpatterns...
    path(
        "microsoft_sso/", include("django_microsoft_sso.urls", namespace="django_microsoft_sso")
    ),
]
  1. And run migrations:
$ python manage.py migrate

That's it. Start django on port 8000 and open your browser in http://localhost:8000/admin/login and you should see the Microsoft SSO button.


License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_microsoft_sso-3.0.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_microsoft_sso-3.0.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file django_microsoft_sso-3.0.1.tar.gz.

File metadata

  • Download URL: django_microsoft_sso-3.0.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/43.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.2 importlib-metadata/7.0.2 keyring/24.3.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

File hashes

Hashes for django_microsoft_sso-3.0.1.tar.gz
Algorithm Hash digest
SHA256 3761a8a20fea3861ce06a7dacf57fab56edbbb3bd337eb7af3c4496640fec8ed
MD5 29738efc0f8187cd343296445106a9b5
BLAKE2b-256 9258b7ee0a7144f9b548c90e08df29b49e0810cf3947e4306c1a6a7dfe064ba2

See more details on using hashes here.

File details

Details for the file django_microsoft_sso-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_microsoft_sso-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/43.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.2 importlib-metadata/7.0.2 keyring/24.3.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

File hashes

Hashes for django_microsoft_sso-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a8a943c0e872aab5a41346219a8afa6ad16efacabeac1f9ba63ce602621959c
MD5 97e1c41c0c68ce0b4c690a12989f9dd2
BLAKE2b-256 1d102e38a3b9675b9222fbfb7ec8a438d5f8d6a52f0f75d5dc7d72594373abce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page