From 106bb9b63dfa48b80110cf70491fb26fb4f68022 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Fri, 14 Jan 2022 15:48:15 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20SAML2=E5=B1=9E=E6=80=A7=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E5=8E=BB=E6=8E=89=E5=9F=9F=E5=90=8D=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/backends/saml2/views.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/authentication/backends/saml2/views.py b/apps/authentication/backends/saml2/views.py index 4ce812fe8..6c7fb5cb8 100644 --- a/apps/authentication/backends/saml2/views.py +++ b/apps/authentication/backends/saml2/views.py @@ -76,11 +76,10 @@ class PrepareRequestMixin: @staticmethod def get_attribute_consuming_service(): attr_mapping = settings.SAML2_RENAME_ATTRIBUTES - name_prefix = settings.SITE_URL if attr_mapping and isinstance(attr_mapping, dict): attr_list = [ { - "name": '{}/{}'.format(name_prefix, sp_key), + "name": sp_key, "friendlyName": idp_key, "isRequired": True } for idp_key, sp_key in attr_mapping.items() @@ -168,12 +167,10 @@ class PrepareRequestMixin: def get_attributes(self, saml_instance): user_attrs = {} - real_key_index = len(settings.SITE_URL) + 1 attrs = saml_instance.get_attributes() valid_attrs = ['username', 'name', 'email', 'comment', 'phone'] for attr, value in attrs.items(): - attr = attr[real_key_index:] if attr not in valid_attrs: continue user_attrs[attr] = self.value_to_str(value)