Repository: goauthentik/authentik

Issue:
scim_sync_all task fails
**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Logs**
<details>
    <summary>Stacktrace from authentik</summary>

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/celery.py", line 231, in _inner
    reraise(*exc_info)
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/_compat.py", line 60, in reraise
    raise value
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/celery.py", line 226, in _inner
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/providers/scim/tasks.py", line 38, in scim_sync_all
    for provider in SCIMProvider.objects.all(backchannel_application__isnull=False):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
builtins.TypeError: BaseManager.all() got an unexpected keyword argument 'backchannel_application__isnull'
```
</details>


**Version and Deployment (please complete the following information):**
- authentik version: 2023.4.1
- Deployment: [e.g. docker-compose, helm]

**Additional context**
Add any other context about the problem here.
        


Discussion:

Resolving patch:
diff --git a/authentik/providers/scim/tasks.py b/authentik/providers/scim/tasks.py
--- a/authentik/providers/scim/tasks.py
+++ b/authentik/providers/scim/tasks.py
@@ -35,7 +35,7 @@ def client_for_model(provider: SCIMProvider, model: Model) -> SCIMClient:
 @CELERY_APP.task()
 def scim_sync_all():
     """Run sync for all providers"""
-    for provider in SCIMProvider.objects.all(backchannel_application__isnull=False):
+    for provider in SCIMProvider.objects.filter(backchannel_application__isnull=False):
         scim_sync.delay(provider.pk)
 
 


Test patch:
diff --git a/authentik/providers/scim/tests/test_client.py b/authentik/providers/scim/tests/test_client.py
--- a/authentik/providers/scim/tests/test_client.py
+++ b/authentik/providers/scim/tests/test_client.py
@@ -7,6 +7,7 @@
 from authentik.lib.generators import generate_id
 from authentik.providers.scim.clients.base import SCIMClient
 from authentik.providers.scim.models import SCIMMapping, SCIMProvider
+from authentik.providers.scim.tasks import scim_sync_all
 
 
 class SCIMClientTests(TestCase):
@@ -82,3 +83,7 @@ def test_config_invalid(self):
             SCIMClient(self.provider)
             self.assertEqual(mock.call_count, 1)
             self.assertEqual(mock.request_history[0].method, "GET")
+
+    def test_scim_sync_all(self):
+        """test scim_sync_all task"""
+        scim_sync_all()
diff --git a/tests/e2e/test_provider_proxy.py b/tests/e2e/test_provider_proxy.py
--- a/tests/e2e/test_provider_proxy.py
+++ b/tests/e2e/test_provider_proxy.py
@@ -74,7 +74,7 @@ def test_proxy_simple(self):
         self.user.save()
 
         proxy: ProxyProvider = ProxyProvider.objects.create(
-            name="proxy_provider",
+            name=generate_id(),
             authorization_flow=Flow.objects.get(
                 slug="default-provider-authorization-implicit-consent"
             ),
@@ -85,9 +85,9 @@ def test_proxy_simple(self):
         proxy.set_oauth_defaults()
         proxy.save()
         # we need to create an application to actually access the proxy
-        Application.objects.create(name="proxy", slug="proxy", provider=proxy)
+        Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy)
         outpost: Outpost = Outpost.objects.create(
-            name="proxy_outpost",
+            name=generate_id(),
             type=OutpostType.PROXY,
         )
         outpost.providers.add(proxy)
@@ -141,7 +141,7 @@ def test_proxy_basic_auth(self):
         self.user.save()
 
         proxy: ProxyProvider = ProxyProvider.objects.create(
-            name="proxy_provider",
+            name=generate_id(),
             authorization_flow=Flow.objects.get(
                 slug="default-provider-authorization-implicit-consent"
             ),
@@ -155,9 +155,9 @@ def test_proxy_basic_auth(self):
         proxy.set_oauth_defaults()
         proxy.save()
         # we need to create an application to actually access the proxy
-        Application.objects.create(name="proxy", slug="proxy", provider=proxy)
+        Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy)
         outpost: Outpost = Outpost.objects.create(
-            name="proxy_outpost",
+            name=generate_id(),
             type=OutpostType.PROXY,
         )
         outpost.providers.add(proxy)
@@ -219,7 +219,7 @@ def test_proxy_connectivity(self):
         proxy.set_oauth_defaults()
         proxy.save()
         # we need to create an application to actually access the proxy
-        Application.objects.create(name="proxy", slug="proxy", provider=proxy)
+        Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy)
         service_connection = DockerServiceConnection.objects.get(local=True)
         outpost: Outpost = Outpost.objects.create(
             name=generate_id(),