From fa5a35321869c78023d1556acfc9ee974f8ae4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Kr=C3=BCger=20Svensson?= Date: Fri, 27 Aug 2021 19:45:31 +0200 Subject: [PATCH 1/2] Fix #179 --- django_auth_adfs/backend.py | 2 +- tests/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django_auth_adfs/backend.py b/django_auth_adfs/backend.py index 98093f5..d5ff8db 100644 --- a/django_auth_adfs/backend.py +++ b/django_auth_adfs/backend.py @@ -92,7 +92,7 @@ def process_access_token(self, access_token, adfs_response=None): claims = self.validate_access_token(access_token) if ( settings.BLOCK_GUEST_USERS - and claims.get('http://schemas.microsoft.com/identity/claims/tenantid') + and claims.get('tid') != settings.TENANT_ID ): logger.info('Guest user denied') diff --git a/tests/utils.py b/tests/utils.py index 78d5b25..5cee25e 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -112,7 +112,7 @@ def do_build_access_token(request, issuer, schema=None): "ver": "1.0" } if schema: - claims['http://schemas.microsoft.com/identity/claims/tenantid'] = schema + claims['tid'] = schema if issuer.startswith('https://sts.windows.net'): claims['upn'] = 'testuser' claims['groups'] = claims['group'] From 0e733f6a4f9e720edbf5a9d8a9e0acea2c49bdcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Kr=C3=BCger=20Svensson?= Date: Fri, 27 Aug 2021 19:47:45 +0200 Subject: [PATCH 2/2] Fix broken BLOCK_GUEST_USERS setting. Closes #179 --- CHANGELOG.rst | 9 +++++++++ django_auth_adfs/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a11653a..34f082a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +`1.8.1`_ - 2021-08-27 +--------------------- + +**Features** + +* Fix broken ``BLOCK_GUEST_USERS`` setting. @JonasKs #180 + + `1.8.0`_ - 2021-08-14 --------------------- @@ -253,6 +261,7 @@ Changelog * Initial release +.. _1.8.1: https://github.com/snok/django-auth-adfs/compare/1.8.0...1.8.1 .. _1.8.0: https://github.com/snok/django-auth-adfs/compare/1.7.0...1.8.0 .. _1.7.0: https://github.com/snok/django-auth-adfs/compare/1.6.1...1.7.0 .. _1.6.1: https://github.com/snok/django-auth-adfs/compare/1.6.0...1.6.1 diff --git a/django_auth_adfs/__init__.py b/django_auth_adfs/__init__.py index 9320862..549c3a4 100644 --- a/django_auth_adfs/__init__.py +++ b/django_auth_adfs/__init__.py @@ -4,4 +4,4 @@ Adding imports here will break setup.py """ -__version__ = '1.8.0' +__version__ = '1.8.1' diff --git a/pyproject.toml b/pyproject.toml index 1ecdc9e..4c31249 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'django-auth-adfs' -version = '1.8.0' # Remember to also change __init__.py version +version = '1.8.1' # Remember to also change __init__.py version description = 'A Django authentication backend for Microsoft ADFS and AzureAD' authors = ['Joris Beckers '] maintainers = ['Jonas Krüger Svensson ', 'Sondre Lillebø Gundersen ']