From 89d449fc4631cb9fb656361db2a63031a02e4c62 Mon Sep 17 00:00:00 2001 From: devo-devo Date: Tue, 11 Oct 2022 14:37:47 +0100 Subject: [PATCH 1/3] passes current request to _update_user to deal with any context specific user attribute processing --- djangosaml2/backends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangosaml2/backends.py b/djangosaml2/backends.py index e7f36fc2..a2072669 100644 --- a/djangosaml2/backends.py +++ b/djangosaml2/backends.py @@ -166,7 +166,7 @@ def authenticate( # Update user with new attributes from incoming request if user is not None: user = self._update_user( - user, attributes, attribute_mapping, force_save=created + user, attributes, attribute_mapping, force_save=created, request=request ) if self.user_can_authenticate(user): From f03d90645693da6a73e5cbfb2280336ee241bfec Mon Sep 17 00:00:00 2001 From: devo-devo Date: Tue, 18 Oct 2022 15:14:14 +0100 Subject: [PATCH 2/3] adds request to _update_user hook --- djangosaml2/backends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/djangosaml2/backends.py b/djangosaml2/backends.py index a2072669..4701494a 100644 --- a/djangosaml2/backends.py +++ b/djangosaml2/backends.py @@ -20,9 +20,9 @@ from django.apps import apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, MultipleObjectsReturned - from django.contrib import auth from django.contrib.auth.backends import ModelBackend +from django.http.request import HttpRequest logger = logging.getLogger("djangosaml2") @@ -173,7 +173,7 @@ def authenticate( return user def _update_user( - self, user, attributes: dict, attribute_mapping: dict, force_save: bool = False + self, user, attributes: dict, attribute_mapping: dict, force_save: bool = False, request: HttpRequest = None ): """Update a user with a set of attributes and returns the updated user. From d88d03b467d1a5fe842cce3d7d3d8ceb115ee3a2 Mon Sep 17 00:00:00 2001 From: devo-devo Date: Tue, 18 Oct 2022 15:16:14 +0100 Subject: [PATCH 3/3] Adds new patch --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c75d7bc4..44a3e4f6 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ def read(*rnames): setup( name="djangosaml2", - version="1.5.3", + version="1.5.4", description="pysaml2 integration for Django", long_description=read("README.md"), long_description_content_type="text/markdown",