ac/login-convenience-bundle
Symfony bundle that streamlines JSON API authentication with OpenID via FpOpenIdBundle. Includes a base User class, JSON login/logout endpoints, auth-header session storage (no cookies), reload-less OpenID flow support, trusted providers, and dummy login mode.
auth:api) may already cover 80% of this functionality.league/oauth2-server, hybridauth/hybridauth) offers more mature OpenID/OAuth solutions.FpOpenIdBundle and Symfony’s AppKernel/security.yml makes Laravel integration non-trivial. Key challenges:
EventDispatcher vs. Laravel’s Events service.security.yml → Laravel’s AuthServiceProvider/auth.php.AuthHeader requires custom Laravel middleware.User/OpenIdIdentity tables would need migration to Laravel’s schema (e.g., users table + pivot tables for OpenID identities).routes/api.php) doesn’t natively support the bundle’s ac_login_convenience_routes. Would require manual route registration or a custom router extension.Security component logic (e.g., AuthenticationUtils, LogoutHandler).EventListener).Authorization headers (Laravel’s default session uses cookies).FpOpenIdBundle) that Laravel lacks?Authorization header-based sessions integrate with Laravel’s CSRF/middleware stack?laravel/sanctum + league/oauth2-openid achieve the same goals with lower risk?auth:api or Sanctum.hybridauth/hybridauth, knuckleswtf/openid-connect).Authorization headers and validate sessions.User/OpenIdIdentity tables to Laravel’s schema:
// Example migration for OpenID identities (pivot table)
Schema::create('openid_identities', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->string('provider')->comment('e.g., "google", "github"');
$table->string('provider_id')->unique();
$table->string('identity_url');
$table->timestamps();
});
knuckleswtf/openid-connect instead.Authorization header-based session middleware:
// app/Http/Middleware/AuthHeaderSession.php
public function handle($request, Closure $next) {
if ($request->bearerToken()) {
$token = $request->bearerToken();
$user = User::where('api_token', $token)->first();
if ($user) auth()->login($user);
}
return $next($request);
}
hybridauth.SecurityController) as Laravel middleware/controllers.security.yml logic with Laravel’s AuthServiceProvider:
// app/Providers/AuthServiceProvider.php
protected function boot() {
$this->registerPolicies();
Passport::routes(); // If using OAuth
// Custom OpenID logic here
}
AuthHeader via app/Providers/AppServiceProvider:
public function register() {
Session::extend('auth_header', function ($app) {
return new AuthHeaderSessionManager($app);
});
}
| Symfony Component | Laravel Equivalent |
|---|---|
security.yml |
AuthServiceProvider/auth.php |
EventDispatcher |
Laravel’s Events facade |
AppKernel |
composer.json + Service Providers |
FOSUserBundle |
Laravel Breeze/Jetstream |
auth:api or Sanctum for baseline functionality.knuckleswtf/openid-connect for provider support.Authorization header sessions.security.yml vs. Laravel’s AuthServiceProvider will require cross-referencing two different debug flows.FpOpenIdBundle may complicate future migrations.Authorization headers.spatie/rate-limiter).| Risk | Mitigation Strategy |
|---|---|
| Session Hijacking | Use short-lived tokens + Authorization: Bearer validation. |
| OpenID Provider Outages | Implement fallback to username/password auth. |
| Middleware Conflicts | Test with Laravel’s built-in middleware (e.g., VerifyCsrfToken). |
| Database Schema Drift | Use Laravel migrations + schema validation. |
| Deprecated Symfony APIs | Abstract bundle logic into interfaces. |
Security component (for rewrites).How can I help you explore Laravel packages today?