Skip to content

Commit 221cda6

Browse files
committed
Add deprecation warnings
1 parent 324f42e commit 221cda6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

djangosaml2/backends.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import logging
1717
from typing import Any, Optional, Tuple
18+
import warnings
1819

1920
from django.apps import apps
2021
from django.conf import settings
@@ -237,3 +238,40 @@ def send_user_update_signal(self, user: settings.AUTH_USER_MODEL, attributes: di
237238
user_modified=user_modified)]
238239
)
239240
return signal_modified
241+
242+
# ############################################
243+
# Backwards-compatibility stubs
244+
# ############################################
245+
246+
def get_attribute_value(self, django_field, attributes, attribute_mapping):
247+
warnings.warn("get_attribute_value() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
248+
self._get_attribute_value(django_field, attributes, attribute_mapping)
249+
250+
def get_django_user_main_attribute(self):
251+
warnings.warn("get_django_user_main_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
252+
self._user_lookup_attribute
253+
254+
def get_django_user_main_attribute_lookup(self):
255+
warnings.warn("get_django_user_main_attribute_lookup() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
256+
return getattr(settings, 'SAML_DJANGO_USER_MAIN_ATTRIBUTE_LOOKUP', '')
257+
258+
def get_user_query_args(self, main_attribute):
259+
warnings.warn("get_user_query_args() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
260+
return {self.get_django_user_main_attribute() + self.get_django_user_main_attribute_lookup()}
261+
262+
def configure_user(self, user, attributes, attribute_mapping):
263+
warnings.warn("configure_user() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
264+
return self._update_user(user, attributes, attribute_mapping)
265+
266+
def update_user(self, user, attributes, attribute_mapping, force_save=False):
267+
warnings.warn("update_user() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
268+
return self._update_user(user, attributes, attribute_mapping)
269+
270+
def _set_attribute(self, obj, attr, value):
271+
warnings.warn("_set_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
272+
return set_attribute(obj, attr, value)
273+
274+
275+
def get_saml_user_model():
276+
warnings.warn("_set_attribute() is deprecated, look at the Saml2Backend on how to subclass it", DeprecationWarning)
277+
return Saml2Backend()._user_model

0 commit comments

Comments
 (0)