*: make user logging more consistent
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
438aac8879
commit
ca40d31dac
|
@ -88,7 +88,7 @@ class PolicyProcess(PROCESS_CLASS):
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"P_ENG(proc): Running policy",
|
"P_ENG(proc): Running policy",
|
||||||
policy=self.binding.policy,
|
policy=self.binding.policy,
|
||||||
user=self.request.user,
|
user=self.request.user.username,
|
||||||
# this is used for filtering in access checking where logs are sent to the admin
|
# this is used for filtering in access checking where logs are sent to the admin
|
||||||
process="PolicyProcess",
|
process="PolicyProcess",
|
||||||
)
|
)
|
||||||
|
@ -124,7 +124,7 @@ class PolicyProcess(PROCESS_CLASS):
|
||||||
# this is used for filtering in access checking where logs are sent to the admin
|
# this is used for filtering in access checking where logs are sent to the admin
|
||||||
process="PolicyProcess",
|
process="PolicyProcess",
|
||||||
passing=policy_result.passing,
|
passing=policy_result.passing,
|
||||||
user=self.request.user,
|
user=self.request.user.username,
|
||||||
)
|
)
|
||||||
return policy_result
|
return policy_result
|
||||||
|
|
||||||
|
|
|
@ -162,10 +162,10 @@ class IdentificationStageView(ChallengeStageView):
|
||||||
if not query:
|
if not query:
|
||||||
self.logger.debug("Empty user query", query=query)
|
self.logger.debug("Empty user query", query=query)
|
||||||
return None
|
return None
|
||||||
users = User.objects.filter(query, is_active=True)
|
user = User.objects.filter(query, is_active=True).first()
|
||||||
if users.exists():
|
if user:
|
||||||
self.logger.debug("Found user", user=users.first(), query=query)
|
self.logger.debug("Found user", user=user.username, query=query)
|
||||||
return users.first()
|
return user
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_challenge(self) -> Challenge:
|
def get_challenge(self) -> Challenge:
|
||||||
|
|
|
@ -56,7 +56,7 @@ def authenticate(
|
||||||
continue
|
continue
|
||||||
# Annotate the user object with the path of the backend.
|
# Annotate the user object with the path of the backend.
|
||||||
user.backend = backend_path
|
user.backend = backend_path
|
||||||
LOGGER.debug("Successful authentication", user=user, backend=backend_path)
|
LOGGER.debug("Successful authentication", user=user.username, backend=backend_path)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
# The credentials supplied are invalid to all backends, fire signal
|
# The credentials supplied are invalid to all backends, fire signal
|
||||||
|
|
|
@ -47,7 +47,7 @@ class UserLoginStageView(StageView):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
"Logged in",
|
"Logged in",
|
||||||
backend=backend,
|
backend=backend,
|
||||||
user=user,
|
user=user.username,
|
||||||
flow_slug=self.executor.flow.slug,
|
flow_slug=self.executor.flow.slug,
|
||||||
session_duration=self.executor.current_stage.session_duration,
|
session_duration=self.executor.current_stage.session_duration,
|
||||||
)
|
)
|
||||||
|
|
Reference in New Issue