offline-agency/filament-spid

SPID authentication plugin for Filament based on italia/spid-laravel

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/offline-agency/filament-spid


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

SPID (Sistema Pubblico di Identità Digitale) authentication plugin for Filament based on italia/spid-laravel.

This package allows you to integrate SPID authentication into your Filament admin panels, enabling Italian public administration identity management.

Filament SPID Banner

Features

  • 🇮🇹 Full SPID integration for Filament
  • 🔐 Secure SAML2 authentication
  • 🎨 Customizable login view
  • 🔧 Compatible with Filament 3 & 4
  • 📦 Support for Laravel 10, 11, 12
  • ⚡ PHP 8.2+ ready
  • 🧪 Fully tested

Requirements

  • PHP 8.2 or higher
  • Laravel 10.x, 11.x, or 12.x
  • Filament 3.x or 4.x
  • italia/spid-laravel package

Installation

You can install the package via composer:

composer require offline-agency/filament-spid

Publish the configuration file:

php artisan vendor:publish --tag="filament-spid-config"

Publish and run the migrations:

php artisan vendor:publish --tag="filament-spid-migrations"
php artisan migrate

Optionally, you can publish the views:

php artisan vendor:publish --tag="filament-spid-views"

SPID Configuration

First, configure the base SPID Laravel package. Follow the italia/spid-laravel documentation to:

  1. Generate SPID certificates
  2. Configure your Service Provider metadata
  3. Set up SPID Identity Providers

Add the following fields to your users table migration (if not already published):

$table->string('fiscal_code')->unique()->nullable();
$table->json('spid_data')->nullable();

Usage

Register the plugin in your Filament Panel Provider:

use OfflineAgency\FilamentSpid\SpidPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('admin')
        ->path('admin')
        ->plugin(
            SpidPlugin::make()
                ->spidButtonLabel('Entra con SPID')
                ->providers([
                    'arubaid',
                    'infocertid',
                    'lepidaid',
                    'namirialid',
                    'posteid',
                    'sielteid',
                    'spiditalia',
                    'timid',
                    'teamsystemid'
                ])
        );
}

Customization

Custom Login View

SpidPlugin::make()
    ->loginView('your-custom-view')

Custom Routes

SpidPlugin::make()
    ->loginRoute('custom.spid.login')
    ->logoutRoute('custom.spid.logout')
    ->acsRoute('custom.spid.acs')
    ->metadataRoute('custom.spid.metadata')

Hide SPID Button

SpidPlugin::make()
    ->showSpidButton(false)

Custom Button Label and Icon

SpidPlugin::make()
    ->spidButtonLabel('Login con SPID')
    ->spidButtonIcon('heroicon-o-shield-check')

Select Specific Providers

SpidPlugin::make()
    ->providers(['posteid', 'arubaid', 'infocertid'])

Configuration

The config/filament-spid.php configuration file allows you to customize:

return [
    'user_model' => \App\Models\User::class,
    'redirect_after_login' => '/admin',
    'spid_level' => 'https://www.spid.gov.it/SpidL2',
];

User Model

Your User model should have these fields:

protected $fillable = [
    'name',
    'email',
    'fiscal_code',
    'spid_data',
    // ... other fields
];

protected $casts = [
    'spid_data' => 'array',
];

SPID Levels

SPID supports three security levels:

  • SpidL1 - Level 1 (Username and password)
  • SpidL2 - Level 2 (Username, password, and OTP) - Default
  • SpidL3 - Level 3 (Smart card or hardware token)

Configure the level in your config file or when calling the login:

route('spid.login', ['provider' => 'posteid', 'level' => 'SpidL2'])

Testing

composer test

Run tests with coverage:

composer test-coverage

Code Style

composer format

Static Analysis

composer analyse

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Support

For support and questions:

License

The MIT License (MIT). Please see License File for more information.

About Offline Agency

Offline Agency is a web development agency based in Italy, specializing in Laravel and Filament applications.