Last updated
Last updated
The Credential Source can be stored the way you want. As the Webauthn\PublicKeyCredentialSource
class can be converted into JSON, it could be stored in a filesystem.
It is up to you to create a credential source repository. This service shall implement Webauthn\Bundle\Repository\PublicKeyCredentialSourceRepositoryInterface
.
Doctrine users: the field type for transports
and other_ui
changed from array
to json
(array
is now deprecated) between the bundle v4.x and 5.0.
Please make sure to reflect the changes to your data model.
Hereafter an example for Postgres:
By default, the User Entity Repository is not able to register any user account. You can add this behaviour by implementing the interface Webauthn\Bundle\Repository\CanRegisterUserEntity
.
In general, Symfony applications use Doctrine and is why the bundle provides a way to use Doctrine as storage system.
Hereafter an example of an entity.
This is the most simple example. Feel free to add custom fields that fits on your needs e.g. created_at
or is_revoked
.
Do not forget to update your database schema!
To ease the integration into your application, the bundle provides a concrete class that you can extend.
In this following example, we extend that class and add a method to get all credentials for a specific user handle. Feel free to add your own methods.
We must override the method saveCredentialSource
because we may receive Webauthn\PublicKeyCredentialSource
objects instead of App\Entity\WebauthnCredential
.
This repository should be declared as a Symfony service.
With Symfony autowiring and autoconfiguration, this is usually done automatically
Where the public keys and details are stored