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
a: install
tmux \
tmux -CC \
new-session 'make run' \; \
split-window 'make web-watch'
# detach-client

View File

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

View File

@ -1,4 +1,5 @@
"""Authenticator Validation"""
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest, HttpResponse
from django_otp import devices_for_user
from rest_framework.fields import CharField, IntegerField, JSONField, ListField, UUIDField
@ -279,7 +280,7 @@ class AuthenticatorValidateStageView(ChallengeStageView):
def challenge_valid(self, response: AuthenticatorValidationChallengeResponse) -> HttpResponse:
# All validation is done by the serializer
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)
if not webauthn_device:
return self.executor.stage_ok()