django-microsoft-sso


Namedjango-microsoft-sso JSON
Version 5.1.0 PyPI version JSON
download
home_pagehttps://github.com/megalus/django-microsoft-sso
SummaryEasily add Microsoft Authentication to your Django Projects
upload_time2025-01-14 20:38:00
maintainerNone
docs_urlNone
authorChris Maillefaud
requires_python<4.0,>=3.11
licenseMIT
keywords microsoft django sso
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="docs/images/django-microsoft-sso.png" alt="Django Microsoft SSO"/>
</p>
<p align="center">
<em>Easily integrate Microsoft Authentication into your Django projects</em>
</p>

<p align="center">
<a href="https://pypi.org/project/django-microsoft-sso/" target="_blank">
<img alt="PyPI" src="https://img.shields.io/pypi/v/django-microsoft-sso"/></a>
<a href="https://github.com/megalus/django-microsoft-sso/actions" target="_blank">
<img alt="Build" src="https://github.com/megalus/django-microsoft-sso/workflows/tests/badge.svg"/>
</a>
<a href="https://www.python.org" target="_blank">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/django-microsoft-sso"/>
</a>
<a href="https://www.djangoproject.com/" target="_blank">
<img alt="PyPI - Django Version" src="https://img.shields.io/pypi/djversions/django-microsoft-sso"/>
</a>
</p>

## 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](https://github.com/AngellusMortis/django_microsoft_auth)
and [django-admin-sso](https://github.com/matthiask/django-admin-sso/)

---

### Documentation

* Docs: https://megalus.github.io/django-microsoft-sso/

---

### Install

```shell
$ pip install django-microsoft-sso
```

### Configure

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

```python
# settings.py

INSTALLED_APPS = [
    # other django apps
    "django.contrib.messages",  # Need for Auth messages
    "django_microsoft_sso",  # Add django_microsoft_sso
]
```

2. In [Microsoft Entra Administration Center](https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade/quickStartType~/null/sourceType/Microsoft_AAD_IAM) create a multi-tenant app registration and at _Application Register_, retrieve your
   Application ID. Navigate to **Certificate & secrets** link, and get the **Client Secret Value**. Add both in your `settings.py`:

```python
# settings.py

MICROSOFT_SSO_APPLICATION_ID = "your Application ID here"
MICROSOFT_SSO_CLIENT_SECRET = "your Client Secret Value here"
MICROSOFT_SSO_SCOPES = ["User.Read.All"]
```

3. Add the callback uri `http://localhost:8000/microsoft_sso/callback/` in your Microsoft Console, on the "Authorized Redirect
   URL".

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

```python
# settings.py

MICROSOFT_SSO_ALLOWABLE_DOMAINS = ["contoso.com"]
```

5. In `urls.py` please add the **Django-Microsoft-SSO** views:

```python
# urls.py

from django.urls import include, path

urlpatterns = [
    # other urlpatterns...
    path(
        "microsoft_sso/", include("django_microsoft_sso.urls", namespace="django_microsoft_sso")
    ),
]
```

6. And run migrations:

```shell
$ 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.

<p align="center">
   <img src="docs/images/django_login_with_microsoft_light.png"/>
</p>

---

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/megalus/django-microsoft-sso",
    "name": "django-microsoft-sso",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "microsoft, django, sso",
    "author": "Chris Maillefaud",
    "author_email": "chrismaille@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/4c/6d/a78234b89a9956accc7c5f3f091a76923cc92c1c04caa44c25725311b281/django_microsoft_sso-5.1.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"docs/images/django-microsoft-sso.png\" alt=\"Django Microsoft SSO\"/>\n</p>\n<p align=\"center\">\n<em>Easily integrate Microsoft Authentication into your Django projects</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/django-microsoft-sso/\" target=\"_blank\">\n<img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/django-microsoft-sso\"/></a>\n<a href=\"https://github.com/megalus/django-microsoft-sso/actions\" target=\"_blank\">\n<img alt=\"Build\" src=\"https://github.com/megalus/django-microsoft-sso/workflows/tests/badge.svg\"/>\n</a>\n<a href=\"https://www.python.org\" target=\"_blank\">\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/django-microsoft-sso\"/>\n</a>\n<a href=\"https://www.djangoproject.com/\" target=\"_blank\">\n<img alt=\"PyPI - Django Version\" src=\"https://img.shields.io/pypi/djversions/django-microsoft-sso\"/>\n</a>\n</p>\n\n## Welcome to Django Microsoft SSO\n\nThis library aims to simplify the process of authenticating users with Microsoft in Django Admin pages,\ninspired by libraries like [django_microsoft_auth](https://github.com/AngellusMortis/django_microsoft_auth)\nand [django-admin-sso](https://github.com/matthiask/django-admin-sso/)\n\n---\n\n### Documentation\n\n* Docs: https://megalus.github.io/django-microsoft-sso/\n\n---\n\n### Install\n\n```shell\n$ pip install django-microsoft-sso\n```\n\n### Configure\n\n1. Add the following to your `settings.py` `INSTALLED_APPS`:\n\n```python\n# settings.py\n\nINSTALLED_APPS = [\n    # other django apps\n    \"django.contrib.messages\",  # Need for Auth messages\n    \"django_microsoft_sso\",  # Add django_microsoft_sso\n]\n```\n\n2. In [Microsoft Entra Administration Center](https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade/quickStartType~/null/sourceType/Microsoft_AAD_IAM) create a multi-tenant app registration and at _Application Register_, retrieve your\n   Application ID. Navigate to **Certificate & secrets** link, and get the **Client Secret Value**. Add both in your `settings.py`:\n\n```python\n# settings.py\n\nMICROSOFT_SSO_APPLICATION_ID = \"your Application ID here\"\nMICROSOFT_SSO_CLIENT_SECRET = \"your Client Secret Value here\"\nMICROSOFT_SSO_SCOPES = [\"User.Read.All\"]\n```\n\n3. Add the callback uri `http://localhost:8000/microsoft_sso/callback/` in your Microsoft Console, on the \"Authorized Redirect\n   URL\".\n\n4. Let Django Microsoft SSO auto create users for allowable domains:\n\n```python\n# settings.py\n\nMICROSOFT_SSO_ALLOWABLE_DOMAINS = [\"contoso.com\"]\n```\n\n5. In `urls.py` please add the **Django-Microsoft-SSO** views:\n\n```python\n# urls.py\n\nfrom django.urls import include, path\n\nurlpatterns = [\n    # other urlpatterns...\n    path(\n        \"microsoft_sso/\", include(\"django_microsoft_sso.urls\", namespace=\"django_microsoft_sso\")\n    ),\n]\n```\n\n6. And run migrations:\n\n```shell\n$ python manage.py migrate\n```\n\nThat's it. Start django on port 8000 and open your browser in `http://localhost:8000/admin/login` and you should see the\nMicrosoft SSO button.\n\n<p align=\"center\">\n   <img src=\"docs/images/django_login_with_microsoft_light.png\"/>\n</p>\n\n---\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easily add Microsoft Authentication to your Django Projects",
    "version": "5.1.0",
    "project_urls": {
        "Homepage": "https://github.com/megalus/django-microsoft-sso",
        "Repository": "https://github.com/megalus/django-microsoft-sso"
    },
    "split_keywords": [
        "microsoft",
        " django",
        " sso"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c48335188a90a7f0d4ee0147fd8e95ca892e2718c08a87916f4715ea352ace37",
                "md5": "bbd11bc2723938fff2c5174fe7ff5e28",
                "sha256": "c5e4443c866a6c6949cdbfd329e8f50bdf6bd60584cc6578ca3c112ad2e29260"
            },
            "downloads": -1,
            "filename": "django_microsoft_sso-5.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bbd11bc2723938fff2c5174fe7ff5e28",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 25882,
            "upload_time": "2025-01-14T20:37:58",
            "upload_time_iso_8601": "2025-01-14T20:37:58.055717Z",
            "url": "https://files.pythonhosted.org/packages/c4/83/35188a90a7f0d4ee0147fd8e95ca892e2718c08a87916f4715ea352ace37/django_microsoft_sso-5.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c6da78234b89a9956accc7c5f3f091a76923cc92c1c04caa44c25725311b281",
                "md5": "78322d43ab09d1ba03fd764e6b80e54d",
                "sha256": "ec10325f5433ca89b1524a1f84619f7ba61608afcbbbed9d8a5b04ce16b9bf9c"
            },
            "downloads": -1,
            "filename": "django_microsoft_sso-5.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "78322d43ab09d1ba03fd764e6b80e54d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 18142,
            "upload_time": "2025-01-14T20:38:00",
            "upload_time_iso_8601": "2025-01-14T20:38:00.228149Z",
            "url": "https://files.pythonhosted.org/packages/4c/6d/a78234b89a9956accc7c5f3f091a76923cc92c1c04caa44c25725311b281/django_microsoft_sso-5.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-14 20:38:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "megalus",
    "github_project": "django-microsoft-sso",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-microsoft-sso"
}
        
Elapsed time: 6.72534s