Repository: goauthentik/authentik

Issue:
Unable to open the login page
**Describe the bug**
Going to the subdomain's root page (`/`) redirects me to `/if/flow/default-authentication-flow/?next=%2F` with the message "Something went wrong! Please try again later."

**To Reproduce**
Likely the same as #9402  

**Expected behavior**
Login should work as expected

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Logs**
```js
{"action": "system_exception", "auth_via": "unauthenticated", "client_ip": "2620:0:2820:2005:834:ae89:75fa:3bf7", "context": {"asn": {"as_org": "RPI-AS", "asn": 91, "network": "2620:0:2820::/48"}, "geo": {"city": "Troy", "continent": "NA", "country": "US", "lat": 42.7273, "long": -73.6696}, "http_request": {"args": {"next": "/"}, "method": "GET", "path": "/api/v3/flows/executor/default-authentication-flow/", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"}, "message": "Traceback (most recent call last):\n  File \"/authentik/flows/views/executor.py\", line 290, in get\n    stage_response = self.current_stage_view.dispatch(request)\n                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/ak-root/venv/lib/python3.12/site-packages/django/views/generic/base.py\", line 143, in dispatch\n    return handler(request, *args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/authentik/flows/stage.py\", line 95, in get\n    challenge = self._get_challenge(*args, **kwargs)\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/authentik/flows/stage.py\", line 172, in _get_challenge\n    challenge = self.get_challenge(*args, **kwargs)\n                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/authentik/stages/identification/stage.py\", line 240, in get_challenge\n    if source.component == \"\":\n       ^^^^^^^^^^^^^^^^\n  File \"/authentik/core/models.py\", line 596, in component\n    raise NotImplementedError\nbuiltins.NotImplementedError: "}, "domain_url": "sso.<domain>.dev", "event": "Created Event", "host": "sso.<domain>.dev", "level": "info", "logger": "authentik.events.models", "pid": 69, "request_id": "250097dcd5c04a24a75d92a11bb1230e", "schema_name": "public", "timestamp": "2024-04-25T01:41:07.963500", "user": {"email": "", "is_anonymous": true, "pk": 1, "username": "AnonymousUser"}}
```

Formatted:

```py
Traceback (most recent call last):
  File "/authentik/flows/views/executor.py", line 290, in get
    stage_response = self.current_stage_view.dispatch(request)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/flows/stage.py", line 95, in get
    challenge = self._get_challenge(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/flows/stage.py", line 172, in _get_challenge
    challenge = self.get_challenge(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/stages/identification/stage.py", line 240, in get_challenge
    if source.component == "":
       ^^^^^^^^^^^^^^^^
  File "/authentik/core/models.py", line 596, in component
    raise NotImplementedError
builtins.NotImplementedError:
```

**Version and Deployment (please complete the following information):**

-   authentik version: [e.g. 2021.8.5] 2024.4.0 (using dev-server hash `gh-541becfe30a1b5534c37b0d3b16c3072974f09f1`)
-   Deployment: [e.g. docker-compose, helm] docker-compose

**Additional context**
N/A



Discussion:
I have the same issue with the same setup/version, but my error is just slightly different towards the tail end. I also see the "something went wrong" page. Note that I upgraded from 2023.8 before running into this issue.

```
Traceback (most recent call last):
  File "/authentik/flows/views/executor.py", line 290, in get
    stage_response = self.current_stage_view.dispatch(request)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/flows/stage.py", line 95, in get
    challenge = self._get_challenge(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/flows/stage.py", line 172, in _get_challenge
    challenge = self.get_challenge(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/stages/identification/stage.py", line 243, in get_challenge
    source_challenge.is_valid()
  File "/ak-root/venv/lib/python3.12/site-packages/rest_framework/serializers.py", line 220, in is_valid
    assert hasattr(self, 'initial_data'), (
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
builtins.AssertionError: Cannot call `.is_valid()` as no `data=` keyword argument was passed when instantiating the serializer instance.
```
@swesner411 see #9402.
Ok, I have narrowed down the problem further. It seems that the in-built source does not have a component.

Resolving patch:
diff --git a/authentik/stages/identification/stage.py b/authentik/stages/identification/stage.py
--- a/authentik/stages/identification/stage.py
+++ b/authentik/stages/identification/stage.py
@@ -237,8 +237,6 @@ def get_challenge(self) -> Challenge:
         )
         for source in sources:
             ui_login_button = source.ui_login_button(self.request)
-            if source.component == "":
-                continue
             if ui_login_button:
                 button = asdict(ui_login_button)
                 source_challenge = ui_login_button.challenge


Test patch: