Skip to content
Snippets Groups Projects
Unverified Commit 738cb29b authored by lukasmatusiewicz's avatar lukasmatusiewicz Committed by GitHub
Browse files

Add multiple webauthn challenges (#8)

* Add multiple webauthn challenges

* rename

* fix multi webauthn
parent cc3c7604
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ You can add our library to your repository as a submodule or install it using Co ...@@ -14,7 +14,7 @@ You can add our library to your repository as a submodule or install it using Co
To install our repository with Composer, run this command in Terminal: To install our repository with Composer, run this command in Terminal:
`composer require privacyidea/privacyidea-php-sdk` `composer require privacyidea/privacyidea-php-client`
Next, you have to run: Next, you have to run:
......
{ {
"name": "privacyidea/privacyidea-php-sdk", "name": "privacyidea/privacyidea-php-client",
"description": "This is the privacyIDEA-PHP-SDK. The library that will help you to connect your plugin to the privacyIDEA server using REST APIs.", "description": "This is the privacyIDEA-PHP-Client. The library that will help you to connect your plugin to the privacyIDEA server using REST APIs.",
"minimum-stability": "stable", "minimum-stability": "stable",
"authors": [ "authors": [
{ {
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"repositories": [ "repositories": [
{ {
"type": "vcs", "type": "vcs",
"url": "https://github.com/privacyidea/sdk-php" "url": "https://github.com/privacyidea/sdk-client"
} }
], ],
"require": { "require": {
......
...@@ -184,16 +184,23 @@ class PIResponse ...@@ -184,16 +184,23 @@ class PIResponse
*/ */
public function webAuthnSignRequest() public function webAuthnSignRequest()
{ {
$ret = ""; $arr = [];
$webauthn = "";
foreach ($this->multiChallenge as $challenge) foreach ($this->multiChallenge as $challenge)
{ {
if ($challenge->type === "webauthn") if ($challenge->type === "webauthn")
{ {
$ret = $challenge->webAuthnSignRequest; $t = json_decode($challenge->webAuthnSignRequest);
break; if (empty($webauthn))
{
$webauthn = $t;
}
$arr[] = $challenge->attributes['webAuthnSignRequest']['allowCredentials'][0];
} }
} }
return $ret; $webauthn->allowCredentials = $arr;
return json_encode($webauthn);
} }
public function u2fSignRequest() public function u2fSignRequest()
......
<?php <?php
require_once('../../src/privacyidea-php-sdk/SDK-Autoloader.php'); require_once('../../src/privacyidea-php-client/SDK-Autoloader.php');
require_once('../../vendor/autoload.php'); require_once('../../vendor/autoload.php');
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment