First release

This commit is contained in:
Italo
2022-06-14 05:17:04 -04:00
commit b60b829b96
119 changed files with 9412 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Laragear\WebAuthn\Assertion\Creator\Pipes;
use Closure;
use Illuminate\Contracts\Config\Repository;
use Laragear\WebAuthn\Assertion\Creator\AssertionCreation;
use Laragear\WebAuthn\Attestation\SessionChallenge;
class CreateAssertionChallenge
{
use SessionChallenge;
/**
* Create a new pipe instance.
*
* @param \Illuminate\Contracts\Config\Repository $config
*/
public function __construct(protected Repository $config)
{
//
}
/**
* Handle the incoming Assertion.
*
* @param \Laragear\WebAuthn\Assertion\Creator\AssertionCreation $assertion
* @param \Closure $next
* @return mixed
*/
public function handle(AssertionCreation $assertion, Closure $next): mixed
{
$options = [];
if ($assertion->acceptedCredentials?->isNotEmpty()) {
$options['credentials'] = $assertion->acceptedCredentials->map->getKey()->toArray();
}
$challenge = $this->storeChallenge($assertion->request, $assertion->userVerification, $options);
$assertion->json->set('challenge', $challenge->data);
return $next($assertion);
}
}