<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) 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"
```
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/44/d6/9f1e8257e69190ff14cc28f2924489bfe2af2d460bd6821943dfaaae46fb/django_microsoft_sso-3.3.1.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) 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\"\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": "3.3.1",
"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": "b381f02b12510a24f0597b147b0a754be958c592d18d9e61e79240b41ef9ed50",
"md5": "260cdd54843fd4790ed54f23ac8edd0b",
"sha256": "fa4313131c4f2cd67b5eaa0d702b875ef6293c9e05928d646651cda9206c0d20"
},
"downloads": -1,
"filename": "django_microsoft_sso-3.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "260cdd54843fd4790ed54f23ac8edd0b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 24065,
"upload_time": "2024-04-09T19:46:17",
"upload_time_iso_8601": "2024-04-09T19:46:17.109550Z",
"url": "https://files.pythonhosted.org/packages/b3/81/f02b12510a24f0597b147b0a754be958c592d18d9e61e79240b41ef9ed50/django_microsoft_sso-3.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "44d69f1e8257e69190ff14cc28f2924489bfe2af2d460bd6821943dfaaae46fb",
"md5": "2bd5569b9d32be9ff338b421a4b2f194",
"sha256": "d1c5df863e2e5ec38d9bfd924ae9465a5056ac1ba98f580963ce080ead3af6a4"
},
"downloads": -1,
"filename": "django_microsoft_sso-3.3.1.tar.gz",
"has_sig": false,
"md5_digest": "2bd5569b9d32be9ff338b421a4b2f194",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 17589,
"upload_time": "2024-04-09T19:46:18",
"upload_time_iso_8601": "2024-04-09T19:46:18.881674Z",
"url": "https://files.pythonhosted.org/packages/44/d6/9f1e8257e69190ff14cc28f2924489bfe2af2d460bd6821943dfaaae46fb/django_microsoft_sso-3.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-09 19:46:18",
"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"
}