assert valid credential response
Dieser Commit ist enthalten in:
Ursprung
ccf091a7e3
Commit
161787d26f
|
@ -15,6 +15,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\Webauthn\Application\Controller\Admin;
|
namespace D3\Webauthn\Application\Controller\Admin;
|
||||||
|
|
||||||
|
use Assert\Assert;
|
||||||
|
use Assert\AssertionFailedException;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\TestingTools\Production\IsMockable;
|
use D3\TestingTools\Production\IsMockable;
|
||||||
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
|
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
|
||||||
use D3\Webauthn\Application\Model\Webauthn;
|
use D3\Webauthn\Application\Model\Webauthn;
|
||||||
|
@ -125,7 +128,7 @@ class d3webauthnadminlogin extends AdminController
|
||||||
return $login->adminLogin(
|
return $login->adminLogin(
|
||||||
d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class)->getRequestEscapedParameter('profile')
|
d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class)->getRequestEscapedParameter('profile')
|
||||||
);
|
);
|
||||||
} catch (WebauthnGetException $e) {
|
} catch (WebauthnGetException|AssertionFailedException $e) {
|
||||||
d3GetOxidDIC()->get('d3ox.webauthn.'.UtilsView::class)->addErrorToDisplay($e);
|
d3GetOxidDIC()->get('d3ox.webauthn.'.UtilsView::class)->addErrorToDisplay($e);
|
||||||
return 'login';
|
return 'login';
|
||||||
}
|
}
|
||||||
|
@ -165,16 +168,19 @@ class d3webauthnadminlogin extends AdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return WebauthnLogin
|
* @return WebauthnLogin
|
||||||
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function getWebAuthnLogin(): WebauthnLogin
|
protected function getWebAuthnLogin(): WebauthnLogin
|
||||||
{
|
{
|
||||||
/** @var Request $request */
|
/** @var Request $request */
|
||||||
$request = d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class);
|
$request = d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class);
|
||||||
|
|
||||||
return oxNew(
|
$credential = $request->getRequestEscapedParameter('credential');
|
||||||
WebauthnLogin::class,
|
$error = $request->getRequestEscapedParameter('error');
|
||||||
$request->getRequestEscapedParameter('credential'),
|
|
||||||
$request->getRequestEscapedParameter('error')
|
Assert::that($credential)->string('credential value expected to be string');
|
||||||
);
|
Assert::that($error)->string('error value expected to be string');
|
||||||
|
|
||||||
|
return oxNew(WebauthnLogin::class, $credential, $error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace D3\Webauthn\Modules\Application\Component;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
use Assert\AssertionFailedException;
|
use Assert\AssertionFailedException;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\TestingTools\Production\IsMockable;
|
use D3\TestingTools\Production\IsMockable;
|
||||||
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
|
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
|
||||||
use D3\Webauthn\Application\Model\Exceptions\WebauthnLoginErrorException;
|
use D3\Webauthn\Application\Model\Exceptions\WebauthnLoginErrorException;
|
||||||
|
@ -163,6 +164,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return WebauthnLogin
|
* @return WebauthnLogin
|
||||||
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function d3GetWebauthnLogin(): WebauthnLogin
|
protected function d3GetWebauthnLogin(): WebauthnLogin
|
||||||
{
|
{
|
||||||
|
@ -172,8 +174,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
|
||||||
$credential = $request->getRequestEscapedParameter('credential');
|
$credential = $request->getRequestEscapedParameter('credential');
|
||||||
$error = $request->getRequestEscapedParameter('error');
|
$error = $request->getRequestEscapedParameter('error');
|
||||||
|
|
||||||
Assert::that($credential)->string('credential value expected to be string')
|
Assert::that($credential)->string('credential value expected to be string');
|
||||||
->notEmpty('credential value expected contained content');
|
|
||||||
Assert::that($error)->string('error value expected to be string');
|
Assert::that($error)->string('error value expected to be string');
|
||||||
|
|
||||||
return oxNew(WebauthnLogin::class, $credential, $error);
|
return oxNew(WebauthnLogin::class, $credential, $error);
|
||||||
|
|
Laden…
In neuem Issue referenzieren