From 61772b75ff57b98362761ab9383d4c669256b124 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 16 Feb 2021 19:20:52 +0100 Subject: [PATCH] providers/saml: fix managed mappings not being set on import --- authentik/providers/saml/processors/metadata_parser.py | 2 +- authentik/providers/saml/tests/test_metadata.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authentik/providers/saml/processors/metadata_parser.py b/authentik/providers/saml/processors/metadata_parser.py index 91425cf51..3f392b4c4 100644 --- a/authentik/providers/saml/processors/metadata_parser.py +++ b/authentik/providers/saml/processors/metadata_parser.py @@ -74,7 +74,7 @@ class ServiceProviderMetadata: # Set all auto-generated Property-mappings as defaults # They should provide a sane default for most applications: provider.property_mappings.set( - SAMLPropertyMapping.objects.filter(name__startswith="Autogenerated") + SAMLPropertyMapping.objects.exclude(managed__isnull=True) ) provider.save() return provider diff --git a/authentik/providers/saml/tests/test_metadata.py b/authentik/providers/saml/tests/test_metadata.py index 512ffd0e5..29dc74b36 100644 --- a/authentik/providers/saml/tests/test_metadata.py +++ b/authentik/providers/saml/tests/test_metadata.py @@ -78,7 +78,7 @@ class TestServiceProviderMetadataParser(TestCase): self.assertEqual(provider.sp_binding, SAMLBindings.POST) self.assertEqual( len(provider.property_mappings.all()), - len(SAMLPropertyMapping.objects.filter(name__startswith="Autogenerated")), + len(SAMLPropertyMapping.objects.exclude(managed__isnull=True)), ) def test_with_signing_cert(self):