Advanced behaviors¶
This section covers advanced WebAuthn features and customization options for Symfony Bundle implementations.
Overview¶
The Symfony WebAuthn Bundle provides sensible defaults for most applications. However, you can customize various behaviors to meet specific security requirements or enhance user experience.
Available topics¶
Security features¶
- Fake Credentials - Prevent user enumeration attacks with fake credentials
- Authenticator Counter - Detect cloned authenticators
- Attestation and Metadata Statement - Verify authenticator trust
- Debugging - Enable debug logging for troubleshooting
User experience¶
- User Verification - Configure biometric or PIN requirements
- Authenticator Selection Criteria - Control authenticator types
- Authentication without Username - Passwordless authentication with resident keys
- Register Additional Authenticators - Allow users to add backup authenticators
Policy & discovery¶
- Client Override Policy - Control which options clients can override (new in 5.3.0)
- Passkey Endpoints - Expose .well-known/passkey-endpoints discovery (new in 5.3.0)
Technical configuration¶
- Extensions - Use WebAuthn protocol extensions
- Cross Origin Authentication - Development environment configuration
Configuration vs code¶
The Symfony Bundle allows configuration through:
- YAML Configuration - Most settings can be configured in
config/packages/webauthn.yaml - Custom Services - Advanced behaviors require creating custom service classes
- Event Listeners - Hook into the authentication process with Symfony events
Symfony-specific features¶
The bundle provides several Symfony-specific features not available in pure PHP:
- Firewall Integration - Seamless integration with Symfony Security
- Dependency Injection - All services available through the service container
- Configuration Profiles - Multiple authentication profiles for different use cases
- Event System - React to WebAuthn events throughout your application
Quick configuration example¶
Here's a common advanced configuration:
config/packages/webauthn.yaml
webauthn:
credential_repository: 'App\Repository\WebauthnCredentialRepository'
user_repository: 'App\Repository\UserRepository'
# Enable debugging in development
logger: 'monolog.logger'
# Custom counter checker to detect cloned authenticators
counter_checker: 'App\Security\CustomCounterChecker'
creation_profiles:
default:
rp:
name: 'My Application'
id: 'example.com'
# Require resident keys for passwordless auth
authenticator_selection_criteria:
authenticator_attachment: !php/const Webauthn\AuthenticatorSelectionCriteria::AUTHENTICATOR_ATTACHMENT_PLATFORM
require_resident_key: true
user_verification: !php/const Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_REQUIRED
request_profiles:
default:
rp_id: 'example.com'
user_verification: !php/const Webauthn\AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_PREFERRED
See also¶
- Firewall Configuration - Basic Symfony Security setup
- Configuration References - Complete configuration options
- Pure PHP Advanced Behaviours - Framework-agnostic implementations
Info
Start with the basic bundle setup in Bundle Installation before diving into advanced behaviors.