Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in latest changes #1

Merged
merged 28 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9613730
Update drf_urls.py
marshad96 Feb 9, 2023
b31e0f6
fix: do not hardcode scopes for azure AD v2
JonasKs Mar 30, 2023
77aedee
docs: add docs for scopes
JonasKs Mar 30, 2023
1f2dc70
tests: fix test
JonasKs Mar 30, 2023
8b7cf83
Merge pull request #273 from marshad96/patch-1
JonasKs Mar 30, 2023
ed486dc
Merge pull request #279 from snok/fix_azure_ad
JonasKs Mar 30, 2023
89ce0f9
Bump sqlparse from 0.4.2 to 0.4.4
dependabot[bot] Apr 21, 2023
3a0cd19
Bump cryptography from 39.0.1 to 41.0.0
dependabot[bot] Jun 2, 2023
97421b6
Bump requests from 2.28.1 to 2.31.0
dependabot[bot] May 23, 2023
7888c10
Add Django 4.2 classifier back.
tim-schilling Jun 5, 2023
70b97c9
Version 1.11.6
tim-schilling Jun 5, 2023
e994a79
Bump cryptography from 41.0.0 to 41.0.2
dependabot[bot] Jul 15, 2023
cc70073
Merge pull request #292 from snok/dependabot/pip/cryptography-41.0.2
JonasKs Jul 15, 2023
7baf921
Use SPDX short code for license in Pyproject.toml
schallis Aug 22, 2023
9a5a9d5
Merge pull request #297 from schallis/fix/update-license
JonasKs Sep 19, 2023
fc19260
Upgrade to Django 5
dicknetherlands Dec 4, 2023
dc304b6
Removed Python 3.7 support since it is now end-of-life, and is causin…
dicknetherlands Dec 4, 2023
075fdfb
Add Python 3.12 to the test suite and classifiers.
tim-schilling Dec 14, 2023
e4e3f23
Version 1.12.0
tim-schilling Dec 14, 2023
bfb3e8f
Unpin dependencies in TOML file.
tim-schilling Dec 14, 2023
2bc47a8
300 align license (#1)
tmakruck Oct 19, 2023
13c26f4
Update docs minimum version of Django.
tim-schilling Dec 14, 2023
ab42c1f
Version 1.13.0
tim-schilling Dec 14, 2023
f8c536b
Drop Django 3.2, 4.0 and 4.1
tim-schilling Dec 14, 2023
9e1b643
Version 1.14.0
tim-schilling Dec 15, 2023
73029ea
Create .readthedocs.yaml
jobec Dec 18, 2023
127c39f
Create requirements.txt for ReadTheDocs
jobec Dec 18, 2023
378f141
Update .readthedocs.yaml
jobec Dec 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,16 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
django-version: [ "3.2", "4.0", "4.1", "4.2a1"]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12"]
django-version: [ "4.2", "5.0"]
drf-version: [ "3.11", "3.12", "3.13" ]
exclude:
# Python 3.7 is incompatible with Django v4+
- django-version: 4.0
python-version: 3.7
- django-version: 4.1
python-version: 3.7
- django-version: 4.2a1
python-version: 3.7
# Python 3.11 is incompatible with Django <v4.1
- django-version: 3.2
python-version: 3.11
- django-version: 4.0
python-version: 3.11
# Python 3.8 is incompatible with Django v5+
- django-version: 5.0
python-version: 3.8
# Python 3.9 is incompatible with Django v5+
- django-version: 5.0
python-version: 3.9
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
21 changes: 21 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
5 changes: 2 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Copyright (c) 2016, Joris Beckers
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this
2. Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

Expand Down
2 changes: 1 addition & 1 deletion django_auth_adfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
Adding imports here will break setup.py
"""

__version__ = '1.11.4'
__version__ = '1.14.0'
10 changes: 9 additions & 1 deletion django_auth_adfs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self):
self.PROXIES = None

self.VERSION = 'v1.0'
self.SCOPES = []

required_settings = [
"AUDIENCE",
Expand Down Expand Up @@ -138,6 +139,10 @@ def __init__(self):
elif "VERSION" in _settings:
raise ImproperlyConfigured("The VERSION cannot be set when TENANT_ID is not set.")

if self.VERSION == "v2.0" and not self.SCOPES and self.RELYING_PARTY_ID:
warnings.warn('Use `SCOPES` for AzureAD instead of RELYING_PARTY_ID', DeprecationWarning)
if not isinstance(self.SCOPES, list):
raise ImproperlyConfigured("Scopes must be a list")
# Overwrite defaults with user settings
for setting, value in _settings.items():
if hasattr(self, setting):
Expand Down Expand Up @@ -346,7 +351,10 @@ def build_authorization_endpoint(self, request, disable_sso=None, force_mfa=Fals
})
if self._mode == "openid_connect":
if settings.VERSION == 'v2.0':
query["scope"] = f"openid api://{settings.RELYING_PARTY_ID}/.default"
if settings.SCOPES:
query['scope'] = " ".join(settings.SCOPES)
else:
query["scope"] = f"openid api://{settings.RELYING_PARTY_ID}/.default"
query.pop("resource")
else:
query["scope"] = "openid"
Expand Down
1 change: 1 addition & 0 deletions django_auth_adfs/drf_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@

urlpatterns = [
re_path(r'^login$', views.OAuth2LoginView.as_view(), name='login'),
re_path(r'^logout$', views.OAuth2LogoutView.as_view(), name='logout'),
]
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Installation
Requirements
------------

* Python 3.5 and above
* Django 1.11 and above
* Python 3.8 and above
* Django 4.2 and above

You will also need the following:

Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinx_rtd_theme
18 changes: 14 additions & 4 deletions docs/settings_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ The dictionary can also map extra details to the Django user account using an
`Extension of the User model <https://docs.djangoproject.com/en/stable/topics/auth/customizing/#extending-the-existing-user-model>`_
Set a dictionary as value in the CLAIM_MAPPING setting with as key the name User model.
You will need to make sure the related field exists before the user authenticates.
This can be done by creating a receiver on the
This can be done by creating a receiver on the
`post_save <https://docs.djangoproject.com/en/4.0/ref/signals/#post-save>`_ signal that
creates the related instance when the ``User`` instance is created.

example

.. code-block:: python

'CLAIM_MAPPING': {'first_name': 'given_name',
'last_name': 'family_name',
'email': 'upn',
'CLAIM_MAPPING': {'first_name': 'given_name',
'last_name': 'family_name',
'email': 'upn',
'userprofile': {
'employee_id': 'employeeid'
}}
Expand Down Expand Up @@ -369,6 +369,16 @@ RETRIES
The number of time a request to the ADFS server is retried. It allows, in combination with :ref:`timeout_setting`
to fine tune the behaviour of the connection to ADFS.


SCOPES
------
* **Default**: ``[]``
* **Type**: ``list``

**Only used when you have v2 AzureAD config**



SERVER
------
* **Default**:
Expand Down
Loading