3brs/enterprise-security-bundle
illuminate/support and illuminate/contracts can bridge gaps (e.g., via symfony/dependency-injection or symfony/http-foundation adapters).laravel/sanctum, laravel/passport).KernelEvents, SecurityEvents) maps cleanly to Laravel’s events/listeners, enabling hook-based customization (e.g., pre-authentication checks, post-login actions)..env + config files paradigm, though the bundle’s Symfony-based config system may require a thin adapter layer.AuthenticatorInterface, SessionTracker) can integrate with Laravel’s Auth facade via custom guards or service providers.Validator can coexist with Laravel’s Validator via shared constraint classes or validator pipelines.Firewall logic translates to Laravel’s middleware groups (e.g., web, api) with minimal rewiring.WebAuthnService to bridge Symfony’s WebAuthnBundle patterns.socialiteproviders by wrapping providers in a unified interface.RateLimiter can integrate with Laravel’s throttle middleware or cache-based rate limiting (e.g., Illuminate\Cache\RateLimiter).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony ↔ Laravel Abstraction Gaps | High | Build adapter classes for core Symfony components (e.g., SymfonyAuthAdapter). |
| WebAuthn Implementation Differences | Medium | Leverage Laravel’s native WebAuthn where possible; abstract bundle-specific logic. |
| Event System Mismatches | Low | Use Laravel’s Events facade to proxy Symfony events or vice versa. |
| Configuration Management | Medium | Map Symfony’s yaml/xml configs to Laravel’s .env + config/security.php. |
| Session Handling | Medium | Extend Laravel’s Session class to support bundle’s SessionTracker traits. |
| Testing Overhead | High | Write integration tests for critical flows (e.g., OAuth, 2FA) using Laravel’s HttpTests. |
Strategic Fit:
laravel/fortify, laravel/breeze)?Adoption Tradeoffs:
EventDispatcher, Validator) in a Laravel codebase?config/ vs. Laravel’s .env) be managed long-term?Performance:
symfony/http-client) that bloat the app?Compliance:
SoftDeletes or custom purge logic?Log facade?Future-Proofing:
symfony/http-foundation (request/response) → Laravel’s Illuminate\Http.ValidatorInterface → Laravel’s Illuminate\Validation\Validator.EventDispatcherInterface → Laravel’s Illuminate\Events\Dispatcher.ContainerInterface → Laravel’s Illuminate\Container\Container.symfony/dependency-injection (for DI container compatibility).symfony/http-client (if using OAuth providers).paragonie/webauthn (if extending WebAuthn beyond Laravel’s native support).Phase 1: Dependency Injection Bridge
EnterpriseSecurityServiceProvider) to:
$this->app->singleton('symfony.event_dispatcher', fn() => new SymfonyEventDispatcher());
$this->app->bind('3brs.security.authenticator', Authenticator::class);
extend() to wrap Symfony validators in Laravel’s Validator facade.Phase 2: Authentication Layer
AuthManager to include the bundle’s AuthenticatorInterface.Auth::guard('enterprise')->attempt($credentials);
Firewall logic to Laravel middleware (e.g., EnterpriseAuthMiddleware).Route::middleware([EnterpriseAuthMiddleware::class])->group(...);
Phase 3: Feature-Specific Integration
| Bundle Feature | Laravel Integration Strategy |
|---|---|
| WebAuthn/Passkeys | Use Laravel’s native WebAuthn where possible; extend with bundle’s WebAuthnService. |
| OAuth | Replace socialiteproviders with bundle’s OAuthService via a unified provider interface. |
| Rate Limiting | Wrap Symfony’s RateLimiter in Laravel’s ThrottlesRequests trait. |
| IP Whitelisting | Extend Laravel’s Middleware to check against the bundle’s IpWhitelistService. |
| Password Policies | Override Laravel’s Password validator with bundle’s PasswordPolicyValidator. |
Phase 4: UI/UX (Optional)
composer.json) to avoid class collisions (e.g., Symfony\Component\HttpFoundation\Request vs. Illuminate\Http\Request).AuthenticatorInterface) over concrete Symfony classes.Bus system if needed.Proof of Concept (2–4 weeks)
**
How can I help you explore Laravel packages today?