stages/authenticator_validate: fix passwordless flows not working

closes #2484

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-03-14 21:15:22 +01:00
parent a77616e942
commit ceb894039e
3 changed files with 4 additions and 4 deletions

View File

@ -137,7 +137,6 @@ install:
cd website && npm i cd website && npm i
a: install a: install
tmux \ tmux -CC \
new-session 'make run' \; \ new-session 'make run' \; \
split-window 'make web-watch' split-window 'make web-watch'
# detach-client

View File

@ -291,7 +291,7 @@ class Application(PolicyBindingModel):
url = self.meta_launch_url url = self.meta_launch_url
if provider := self.get_provider(): if provider := self.get_provider():
url = provider.launch_url url = provider.launch_url
if user: if user and url:
if isinstance(user, SimpleLazyObject): if isinstance(user, SimpleLazyObject):
user._setup() user._setup()
user = user._wrapped user = user._wrapped

View File

@ -1,4 +1,5 @@
"""Authenticator Validation""" """Authenticator Validation"""
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from django_otp import devices_for_user from django_otp import devices_for_user
from rest_framework.fields import CharField, IntegerField, JSONField, ListField, UUIDField from rest_framework.fields import CharField, IntegerField, JSONField, ListField, UUIDField
@ -279,7 +280,7 @@ class AuthenticatorValidateStageView(ChallengeStageView):
def challenge_valid(self, response: AuthenticatorValidationChallengeResponse) -> HttpResponse: def challenge_valid(self, response: AuthenticatorValidationChallengeResponse) -> HttpResponse:
# All validation is done by the serializer # All validation is done by the serializer
user = self.executor.plan.context.get(PLAN_CONTEXT_PENDING_USER) user = self.executor.plan.context.get(PLAN_CONTEXT_PENDING_USER)
if not user: if not user or isinstance(user, AnonymousUser):
webauthn_device: WebAuthnDevice = response.data.get("webauthn", None) webauthn_device: WebAuthnDevice = response.data.get("webauthn", None)
if not webauthn_device: if not webauthn_device:
return self.executor.stage_ok() return self.executor.stage_ok()