Fix authentication request creation
This commit is contained in:
parent
969d40d6c1
commit
54c7207836
2 changed files with 11 additions and 13 deletions
|
@ -75,7 +75,7 @@ class LoginController extends AbstractLoginController
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->use_totp && empty($user->security_keys_count)) {
|
if (!$user->use_totp && empty($user->securityKeys)) {
|
||||||
return $this->sendLoginResponse($user, $request);
|
return $this->sendLoginResponse($user, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,21 +88,19 @@ class LoginController extends AbstractLoginController
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'complete' => false,
|
'complete' => false,
|
||||||
'methods' => array_filter([
|
'methods' => array_values(array_filter([
|
||||||
$user->use_totp ? self::METHOD_TOTP : null,
|
$user->use_totp ? self::METHOD_TOTP : null,
|
||||||
$user->security_keys_count > 0 ? self::METHOD_WEBAUTHN : null,
|
!empty($user->securityKeys) ? self::METHOD_WEBAUTHN : null,
|
||||||
]),
|
])),
|
||||||
'confirmation_token' => $token,
|
'confirmation_token' => $token,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user->security_keys_count > 0) {
|
if (!empty($user->securityKeys)) {
|
||||||
// $key = $this->service->handle($user);
|
$key = $this->service->handle($user);
|
||||||
//
|
|
||||||
// $request->session()->put(self::SESSION_PUBLICKEY_REQUEST, $publicKey);
|
$request->session()->put(self::SESSION_PUBLICKEY_REQUEST, $key);
|
||||||
//
|
|
||||||
// $response['webauthn'] = [
|
$response['webauthn'] = ['public_key' => $key];
|
||||||
// 'public_key' => $publicKey,
|
|
||||||
// ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResponse($response);
|
return new JsonResponse($response);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class GeneratePublicKeyCredentialsRequestService
|
||||||
{
|
{
|
||||||
$credentials = $user->securityKeys->map(function (SecurityKey $key) {
|
$credentials = $user->securityKeys->map(function (SecurityKey $key) {
|
||||||
return $key->getPublicKeyCredentialDescriptor();
|
return $key->getPublicKeyCredentialDescriptor();
|
||||||
});
|
})->values()->toArray();
|
||||||
|
|
||||||
$response = $this->serverRepository->getServer($user)
|
$response = $this->serverRepository->getServer($user)
|
||||||
->generatePublicKeyCredentialRequestOptions(
|
->generatePublicKeyCredentialRequestOptions(
|
||||||
|
|
Loading…
Reference in a new issue