From 79fe8187eeea04087ac6baf1e1c0f3eea8414f82 Mon Sep 17 00:00:00 2001 From: lukasmatusiewicz <lukas.matusiewicz@netknights.it> Date: Mon, 24 Jan 2022 15:29:27 +0100 Subject: [PATCH] fix multi webauthn --- src/PIResponse.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/PIResponse.php b/src/PIResponse.php index 526cbaa..93da798 100644 --- a/src/PIResponse.php +++ b/src/PIResponse.php @@ -184,25 +184,23 @@ class PIResponse */ public function webAuthnSignRequest() { - $ret = ""; + $arr = []; + $webauthn = ""; foreach ($this->multiChallenge as $challenge) { if ($challenge->type === "webauthn") { $t = json_decode($challenge->webAuthnSignRequest); - $t->allowCredentials = null; - foreach ($this->multiChallenge as $chall) + if (empty($webauthn)) { - if ($chall->type === "webauthn") - { - $t->allowCredentials[] = $chall->attributes['webAuthnSignRequest']['allowCredentials'][0]; - } + $webauthn = $t; } - $ret = json_encode($t); - break; + $arr[] = $challenge->attributes['webAuthnSignRequest']['allowCredentials'][0]; } } - return $ret; + $webauthn->allowCredentials = $arr; + + return json_encode($webauthn); } public function u2fSignRequest() -- GitLab