- Can I use alexandret/phpcas-guard-bundle directly in Laravel without Symfony?
- No, this bundle is designed for Symfony 3.4+ and relies on Symfony’s Security Guard, DependencyInjection, and event systems. You’ll need to create Laravel-compatible adapters (e.g., middleware, service providers) to bridge the gap, or use the underlying jasig/phpcas library directly.
- What Laravel versions does this package support?
- The package itself doesn’t support Laravel natively, but you can integrate it with Laravel 8+ by leveraging Symfony components like `symfony/http-foundation` for compatibility. Test thoroughly, as Laravel’s service container and auth system differ from Symfony’s.
- How do I configure CAS server settings in Laravel?
- Since the bundle uses Symfony’s YAML config, you’ll need to map settings to Laravel’s `.env` or `config/cas.php`. Example: Set `CAS_HOSTNAME` in `.env` and create a Laravel service to pass these values to jasig/phpcas or a custom authenticator.
- Does this package support CAS 3.0 or only older versions?
- Yes, it supports CAS 1.0, 2.0, and 3.0 via jasig/phpcas, which is the underlying library. The bundle itself doesn’t add protocol-specific limitations, so all versions are compatible if your CAS server supports them.
- Is there a simpler Laravel-native alternative to this bundle?
- Yes, consider `spatie/laravel-cas`, which is designed specifically for Laravel and avoids Symfony dependencies. It’s more maintainable and easier to integrate, though it may lack some advanced Guard features.
- How do I handle CAS authentication routes in Laravel?
- You’ll need to manually define routes for `/cas/login`, `/cas/validate`, etc., in Laravel’s `routes/web.php`. Use middleware to delegate CAS logic to a service wrapping jasig/phpcas or a custom Guard-like authenticator.
- Will this bundle work with Laravel’s built-in auth system?
- Indirectly, yes. You’ll need to create a custom UserProvider or extend Laravel’s `AuthenticatesUsers` trait to integrate with the bundle’s authenticator. The bundle’s Guard logic won’t map directly, so abstraction is required.
- Is this package actively maintained? Should I use it for production?
- No, the last release was in 2020, and it’s abandoned. For production, fork the package or use a Laravel-native CAS solution like `spatie/laravel-cas`. Monitor for community forks or consider Symfony’s native Guard if CAS is critical.
- How do I test CAS authentication in Laravel with this bundle?
- Isolate CAS logic in a testable service layer using jasig/phpcas directly. Mock the CAS server responses (e.g., with VCR or HTTP client stubs) and test your Laravel middleware or authenticator class in isolation.
- What are the performance implications of using CAS with this bundle?
- CAS adds overhead due to token validation rounds-trips to the CAS server. For high-traffic apps, cache validated tokens or consider lighter-weight alternatives like OAuth2 (Laravel Passport) or SAML. Benchmark under load.