- Can I use this bundle in Laravel 9/10 without Symfony’s full stack?
- Yes, but you’ll need to wrap it in a Laravel service provider and abstract Symfony dependencies (e.g., Doctrine ORM) using Eloquent or custom repositories. The bundle relies on Symfony’s security and HTTP components, so isolate them via Composer’s `replace` directives to avoid conflicts with Laravel’s native packages.
- How do I store OAuth tokens in Laravel’s database instead of Doctrine?
- Replace the Doctrine entities (`OAuthToken`, `OAuthClient`) with Eloquent models that mirror their structure. Configure the bundle’s `token_storage` to point to your custom repository, which extends Symfony’s `TokenStorage` interface. This requires mapping Symfony’s event listeners to Laravel’s event system for token lifecycle management.
- Does this bundle support Laravel’s Passport for hybrid authentication?
- Not natively, but you can use this bundle for complex OAuth flows (e.g., PKCE, custom grants) while delegating JWT handling to Passport. Route `/oauth/v2/token` to this bundle and `/oauth/token` to Passport, or merge their guards via Laravel’s `AuthManager` for unified authentication.
- What Laravel versions and Symfony dependencies does this bundle require?
- The bundle targets Symfony 5.4/6.x, which must be bridged to Laravel 9/10 using `symfony/bridge` packages. Ensure your `composer.json` replaces conflicting Symfony dependencies (e.g., `security-core`, `dependency-injection`) with versions compatible with your Laravel installation.
- How do I handle manager_authentication (Akeneo’s fork feature) in Laravel?
- Extend Laravel’s `AuthManager` to support the bundle’s `manager_authentication` by creating a custom guard that implements Symfony’s `ManagerAuthenticatedInterface`. Bind this guard to the bundle’s `security.authentication.manager` in your service provider’s configuration.
- Are there performance concerns with Symfony’s event system in Laravel?
- Yes, Symfony’s event dispatcher may introduce latency. Mitigate this by isolating event listeners to critical paths (e.g., token issuance) and benchmarking against native Laravel solutions like `spatie/laravel-oauth-server`. Use Redis for token storage to reduce database load.
- Can I use this bundle for B2C user authentication (e.g., social logins)?
- While possible, it’s overkill for simple B2C flows. For social logins, consider `spatie/laravel-socialite` or Laravel Passport. This bundle excels in B2B scenarios with custom grants, client credentials, or high-security token validation.
- How do I log OAuth events (e.g., token revocation) in Laravel’s logging system?
- Override Symfony’s event listeners to dispatch Laravel events (e.g., `oauth.token.revoked`). Use Laravel’s `Log` facade or a monitoring tool like Sentry to capture these events. Example: Convert `TokenEvent` to a Laravel event and log it via `event(new OAuthTokenRevoked($token));`.
- What alternatives exist for Laravel OAuth2 servers with tighter integration?
- For native Laravel solutions, evaluate `spatie/laravel-oauth-server` (simpler, Eloquent-based) or `lcobucci/jwt` for custom JWT flows. If you need PKCE or custom grants, consider `darkaonline/l5-swagger` (for API docs) paired with this bundle for enterprise auth.
- How do I test this bundle in a Laravel CI pipeline (e.g., GitHub Actions)?
- Mock Symfony’s `HttpFoundation` and `Security` components using Laravel’s `Http` and `Auth` facades. Test token storage with Eloquent factories, and validate middleware routes (e.g., `/oauth/v2/token`) using `Http::fake()`. Isolate Symfony dependencies in a separate test container to avoid conflicts.