Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions authentik/core/sources/flow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,10 @@
from django.utils.translation import gettext as _
from structlog.stdlib import get_logger

from authentik.core.models import (
Group,
GroupSourceConnection,
Source,
User,
UserSourceConnection,
)
from authentik.core.models import Group, GroupSourceConnection, Source, User, UserSourceConnection
from authentik.core.sources.mapper import SourceMapper
from authentik.core.sources.matcher import Action, SourceMatcher
from authentik.core.sources.stage import (
PLAN_CONTEXT_SOURCES_CONNECTION,
PostSourceStage,
)
from authentik.core.sources.stage import PLAN_CONTEXT_SOURCES_CONNECTION, PostSourceStage
from authentik.events.models import Event, EventAction
from authentik.flows.exceptions import FlowNonApplicableException
from authentik.flows.models import Flow, FlowToken, Stage, in_memory_stage
Expand Down Expand Up @@ -101,9 +92,7 @@ def __init__(
self.source, self.user_connection_type, self.group_connection_type
)
self.request = request
self.identifier = identifier
self.user_info = user_info
self._logger = get_logger().bind(source=source, identifier=identifier)
self.policy_context = policy_context

self.user_properties = self.mapper.build_object_properties(
Expand All @@ -121,6 +110,13 @@ def __init__(
}
del self.user_properties["groups"]

if "id" in self.user_properties:
self.identifier = str(self.user_properties["id"])
else:
self.identifier = identifier

self._logger = get_logger().bind(source=source, identifier=self.identifier)

def get_action(self, **kwargs) -> tuple[Action, UserSourceConnection | None]: # noqa: PLR0911
"""decide which action should be taken"""
# When request is authenticated, always link
Expand Down
Loading