stages/authenticator_validate: add more logging for challenges
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
7834146efc
commit
5235e00d3c
|
@ -91,6 +91,7 @@ class AuthenticatorValidateStageView(ChallengeStageView):
|
||||||
"""Get a list of all device challenges applicable for the current stage"""
|
"""Get a list of all device challenges applicable for the current stage"""
|
||||||
challenges = []
|
challenges = []
|
||||||
user_devices = devices_for_user(self.get_pending_user())
|
user_devices = devices_for_user(self.get_pending_user())
|
||||||
|
LOGGER.debug("Got devices for user", devices=user_devices)
|
||||||
|
|
||||||
# static and totp are only shown once
|
# static and totp are only shown once
|
||||||
# since their challenges are device-independant
|
# since their challenges are device-independant
|
||||||
|
@ -101,6 +102,7 @@ class AuthenticatorValidateStageView(ChallengeStageView):
|
||||||
for device in user_devices:
|
for device in user_devices:
|
||||||
device_class = device.__class__.__name__.lower().replace("device", "")
|
device_class = device.__class__.__name__.lower().replace("device", "")
|
||||||
if device_class not in stage.device_classes:
|
if device_class not in stage.device_classes:
|
||||||
|
LOGGER.debug("device class not allowed", device_class=device_class)
|
||||||
continue
|
continue
|
||||||
# Ensure only classes in PER_DEVICE_CLASSES are returned per device
|
# Ensure only classes in PER_DEVICE_CLASSES are returned per device
|
||||||
# otherwise only return a single challenge
|
# otherwise only return a single challenge
|
||||||
|
@ -108,15 +110,16 @@ class AuthenticatorValidateStageView(ChallengeStageView):
|
||||||
continue
|
continue
|
||||||
if device_class not in seen_classes:
|
if device_class not in seen_classes:
|
||||||
seen_classes.append(device_class)
|
seen_classes.append(device_class)
|
||||||
challenges.append(
|
challenge = DeviceChallenge(
|
||||||
DeviceChallenge(
|
|
||||||
data={
|
data={
|
||||||
"device_class": device_class,
|
"device_class": device_class,
|
||||||
"device_uid": device.pk,
|
"device_uid": device.pk,
|
||||||
"challenge": get_challenge_for_device(self.request, device),
|
"challenge": get_challenge_for_device(self.request, device),
|
||||||
}
|
}
|
||||||
).initial_data
|
|
||||||
)
|
)
|
||||||
|
challenge.is_valid()
|
||||||
|
challenges.append(challenge.data)
|
||||||
|
LOGGER.debug("adding challenge for device", challenge=challenge)
|
||||||
return challenges
|
return challenges
|
||||||
|
|
||||||
def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
|
def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
|
||||||
|
|
Reference in New Issue