<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.10",
"maintainer_email": null,
"keywords": "microsoft, django, sso",
"author": "Chris Maillefaud",
"author_email": "chrismaille@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/18/7a/c888e0b30d466aa2e95d6dc553fbcdc9de772921a04dc57074101d2e3ba7/django_microsoft_sso-4.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\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easily add Microsoft Authentication to your Django Projects",
"version": "4.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": "c1ffa1f6f19079f2c0e54779a764b8f57251fd3e471c25faeaa6afa91969e7b7",
"md5": "e11123658ba63f968f2062e2613f063b",
"sha256": "bf579b4468551a018b593befb657ad5fc829360b4c7544bee143aef0e125befd"
},
"downloads": -1,
"filename": "django_microsoft_sso-4.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e11123658ba63f968f2062e2613f063b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 25837,
"upload_time": "2024-09-17T18:17:23",
"upload_time_iso_8601": "2024-09-17T18:17:23.623444Z",
"url": "https://files.pythonhosted.org/packages/c1/ff/a1f6f19079f2c0e54779a764b8f57251fd3e471c25faeaa6afa91969e7b7/django_microsoft_sso-4.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "187ac888e0b30d466aa2e95d6dc553fbcdc9de772921a04dc57074101d2e3ba7",
"md5": "a7b71a9d519e470bc82a17458bdd61f0",
"sha256": "c06a962c010b1ed7541b7ed6bd15cacce56e4efce6daee5b20239b42c5ce4058"
},
"downloads": -1,
"filename": "django_microsoft_sso-4.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a7b71a9d519e470bc82a17458bdd61f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 19062,
"upload_time": "2024-09-17T18:17:24",
"upload_time_iso_8601": "2024-09-17T18:17:24.673805Z",
"url": "https://files.pythonhosted.org/packages/18/7a/c888e0b30d466aa2e95d6dc553fbcdc9de772921a04dc57074101d2e3ba7/django_microsoft_sso-4.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-17 18:17:24",
"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"
}