Search by

skrull / sylius-admin-passkey-login-plugin

crydotsnake

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

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

v0.2.0 2026-11-22 14:37 UTC

This package is auto-updated.

Last update: 2026-11-23 10:19:07 UTC


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

Managing passkeys on the own account

Signing in with a passkey

Signing in with a passkey

Other admins' accounts

Only the currently logged-in admin can manage their own passkeys.

Passkey section on another admin's account

Installation

  1. Require the plugin:

    composer require skrull/sylius-admin-passkey-login-plugin
  2. 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.yaml with the dummy repositories DummyPublicKeyCredentialSourceRepository and DummyPublicKeyCredentialUserEntityRepository. Remove the credential_repository and user_repository lines (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_ID and RELYING_PARTY_NAME in .env. The plugin does not use them.
  3. Import the plugin configuration in config/packages/skrull_sylius_admin_passkey_login.yaml:

    imports:
        - { resource: "@SKrullSyliusAdminPasskeyLoginPlugin/config/config.yaml" }
  4. Import the routes in config/routes/skrull_sylius_admin_passkey_login.yaml:

    skrull_sylius_admin_passkey_login_admin:
        resource: "@SKrullSyliusAdminPasskeyLoginPlugin/config/routes/admin.yaml"
  5. Enable the passkey login in the admin firewall in config/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 own security.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.

  6. Run the migrations (MySQL/MariaDB and PostgreSQL are supported):

    bin/console doctrine:migrations:migrate
  7. Add the plugin JavaScript to your admin entry point assets/admin/entrypoint.js and rebuild the assets:

    import '../../vendor/skrull/sylius-admin-passkey-login-plugin/assets/admin/entrypoint';
    yarn build
  8. 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.