定制 offline-agency/filament-spid 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

offline-agency/filament-spid

最新稳定版本:0.1.8

Composer 安装命令:

composer require offline-agency/filament-spid

包简介

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

README 文档

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"

Publishing Images

To publish the SPID AGID logo images to your public directory:

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

This will copy the SPID AGID logo images (both PNG and SVG formats) to:

  • public/vendor/filament-spid/images/
  • public/images/

The images will be accessible at:

  • /vendor/filament-spid/images/spid-agid-logo.png
  • /vendor/filament-spid/images/spid-agid-logo.svg

Alternatively, you can use the provided script in the package root:

./publish-images.sh

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.

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-09