skrull / sylius-admin-passkey-login-plugin
Passkey (WebAuthn) login support for the Sylius admin
Package info
github.com/crydotsnake/SyliusAdminPasskeyLoginPlugin
Type:sylius-plugin
pkg:composer/skrull/sylius-admin-passkey-login-plugin
Requires
- php: ^8.4
- sylius/grid-bundle: ^1.16.1
- sylius/sylius: ^2.0
- symfony/clock: ^7.4 || ^8.0
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/routing: ^7.4 || ^8.0
- symfony/security-bundle: ^7.4 || ^8.0
- symfony/security-core: ^7.4 || ^8.0
- symfony/security-csrf: ^7.4 || ^8.0
- symfony/security-http: ^7.4 || ^8.0
- symfony/uid: ^7.4 || ^8.0
- web-auth/webauthn-lib: ^5.3.9
- web-auth/webauthn-symfony-bundle: ^5.3.9
Requires (Dev)
- madewithlove/license-checker: ^3.2
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.1
- phpstan/phpstan-doctrine: ^2.0.12
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.5
- sylius/sylius-rector: ^3.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/debug-bundle: ^7.4 || ^8.0
- symfony/dotenv: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/intl: ^7.4 || ^8.0
- symfony/runtime: ^7.4 || ^8.0
- symfony/web-profiler-bundle: ^7.4 || ^8.0
- symfony/webpack-encore-bundle: ^2.2
- symplify/easy-coding-standard: ^13.0
- vincentlanglet/twig-cs-fixer: ^4.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Lets Sylius administrators sign in with a passkey (WebAuthn / FIDO2) instead of a password - using Touch ID, Face ID, Windows Hello, Android, a password manager or a FIDO2 security key (plain U2F keys are not supported, since discoverable credentials are required).
Built on top of web-auth/webauthn-symfony-bundle.
Features
- Admins can add and delete passkeys on the edit page of their own account. Other admins only see a notice.
- The administrators grid shows which admins have a passkey.
- The login page gets a "Sign in with a passkey" button. No username has to be typed (discoverable credentials).
- Admins can also edit the names of their passkeys.
The login with password still works as before.
Requirements
| Version | |
|---|---|
| PHP | 8.4 or higher |
| Sylius | 2.0 - 2.3 with Symfony 7.4, Sylius 2.3 with Symfony 8 |
| Database | MySQL / MariaDB or PostgreSQL |
WebAuthn only works on HTTPS (or localhost). The browser has to support the WebAuthn JSON helpers
(Chrome/Edge 129+, Firefox 119+, Safari 18.4+); in older browsers the passkey UI is hidden.
Demo
Managing passkeys
Signing in with a passkey
Other admins' accounts
Only the currently logged-in admin can manage their own passkeys.
Installation
-
Require the plugin:
composer require skrull/sylius-admin-passkey-login-plugin
-
Register the bundles in
config/bundles.php(if Symfony Flex has not done it already):return [ // ... Webauthn\Bundle\WebauthnBundle::class => ['all' => true], SKrull\SyliusAdminPasskeyLoginPlugin\SKrullSyliusAdminPasskeyLoginPlugin::class => ['all' => true], ];
If Symfony Flex executed the contrib recipe of
web-auth/webauthn-symfony-bundle, it created:config/packages/webauthn.yamlwith the dummy repositoriesDummyPublicKeyCredentialSourceRepositoryandDummyPublicKeyCredentialUserEntityRepository. Remove thecredential_repositoryanduser_repositorylines (or the whole file): they override the repositories of the plugin, and passkeys would be neither saved nor found.config/routes/webauthn_routes.yaml. It can be deleted: the plugin routes already import the WebAuthn routes.- The variables
RELYING_PARTY_IDandRELYING_PARTY_NAMEin.env. The plugin does not use them.
-
Import the plugin configuration in
config/packages/skrull_sylius_admin_passkey_login.yaml:imports: - { resource: "@SKrullSyliusAdminPasskeyLoginPlugin/config/config.yaml" }
-
Import the routes in
config/routes/skrull_sylius_admin_passkey_login.yaml:skrull_sylius_admin_passkey_login_admin: resource: "@SKrullSyliusAdminPasskeyLoginPlugin/config/routes/admin.yaml"
-
Enable the passkey login in the
adminfirewall inconfig/packages/security.yaml:security: firewalls: admin: # ... existing configuration (form_login, remember_me, ...) webauthn: authentication: profile: skrull_admin_passkey routes: options_path: '/%sylius_admin.path_name%/login/passkey/options' result_path: '/%sylius_admin.path_name%/login/passkey' success_handler: skrull_sylius_admin_passkey_login.security.passkey_authentication_success_handler
Both paths are below
/admin/login, which Sylius already allows for anonymous users. The block has to be added to your ownsecurity.yaml: Symfony only accepts new firewall settings from the file that defines the firewalls, so the plugin cannot ship it. Without this block, passkeys can still be managed, but the login page shows no passkey button. -
Run the migrations (MySQL/MariaDB and PostgreSQL are supported):
bin/console doctrine:migrations:migrate
-
Add the plugin JavaScript to your admin entry point
assets/admin/entrypoint.jsand rebuild the assets:import '../../vendor/skrull/sylius-admin-passkey-login-plugin/assets/admin/entrypoint';
yarn build
-
Clear the cache:
bin/console cache:clear
Configuration
The plugin pre-configures the WebAuthn bundle with its own profile skrull_admin_passkey.
All defaults are defined in the plugin's config/packages/webauthn.yaml.
Single values can be overridden in your application's config/packages/webauthn.yaml, for example the relying party ID
(by default the browser uses the domain of the admin panel):
webauthn: creation_profiles: skrull_admin_passkey: rp: id: 'shop.example.com' request_profiles: skrull_admin_passkey: rp_id: 'shop.example.com'
The name shown by the browser defaults to Sylius Administration and can be changed with
creation_profiles.skrull_admin_passkey.rp.name. This option is deprecated since web-auth/webauthn-lib 5.3 and
will be removed in 6.0. If you set it to '', you also have to set rp.id: the bundle then uses the ID as name,
otherwise the browser rejects the registration.
Lists are merged, not replaced: values added to public_key_credential_parameters are appended to the default
algorithms, so ES256 and RS256 cannot be removed this way.
Defaults: discoverable credentials (resident_key: required), user verification required
(fingerprint, face or PIN), no attestation, algorithms ES256 and RS256.
The plugin sets the global options webauthn.credential_repository and webauthn.user_repository.
If your shop already uses the WebAuthn bundle for other users (e.g. customers), you need repositories
that handle both.
Security notes
- A passkey is always attached to the logged-in admin; the registration endpoints never take a user from the request.
- The passkey login always signs in the owner of the passkey; the user is never looked up by username or email.
- Deleting a passkey requires a CSRF token. A passkey of another admin is answered with
404. - The login response does not reveal whether an account exists or has a passkey; unknown usernames get fake, stable credential IDs from the WebAuthn bundle.
- Disabled admins cannot sign in with a passkey (the firewall user checker applies).
- Cloned authenticators are detected through the signature counter where the authenticator supports it.
Development
The repository contains a Sylius test application. With DDEV:
ddev start ddev bootstrap
Checks:
ddev exec vendor/bin/phpunit
vendor/bin/phpstan analyse
vendor/bin/ecs check
License
The SyliusAdminPasskeyLogin Plugin is released under the MIT License. For more information see the license file: LICENSE.


