Additional Authenticators
Why Multiple Authenticators?
Listing User Authenticators
<?php
declare(strict_types=1);
namespace App\Controller;
use App\Repository\WebauthnCredentialRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
#[IsGranted('ROLE_USER')]
class SecurityController extends AbstractController
{
#[Route('/security/authenticators', name: 'app_list_authenticators')]
public function listAuthenticators(
WebauthnCredentialRepository $credentialRepository
): Response {
$user = $this->getUser();
$userHandle = $user->getUserIdentifier(); // Or your user ID method
$credentials = $credentialRepository->findAllForUserEntity($userHandle);
return $this->render('security/authenticators.html.twig', [
'credentials' => $credentials,
]);
}
}Removing Authenticators
Naming Authenticators
Best Practices
Encourage Backup Authenticators
Authenticator Metadata
Security Recommendations
See Also
Last updated
Was this helpful?