定制 webteractive/filament-passport 二次开发

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

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

webteractive/filament-passport

Composer 安装命令:

composer require webteractive/filament-passport

包简介

A Filament plugin to manage Laravel Passport OAuth clients, tokens, and auth codes.

README 文档

README

A Filament plugin to manage Laravel Passport OAuth clients, access tokens, and authorization codes. Ships with default OAuth consent views so Passport works out of the box.

Note: Device flow (Device Authorization grant) requires Laravel Passport v13. All other features work with Passport v12 and v13.

Requirements

  • PHP 8.2+
  • Filament 4.x or 5.x
  • Laravel Passport 12.x or 13.x

Installation

Make sure Laravel Passport is installed and migrated first:

php artisan install:api --passport

Then install the plugin:

composer require webteractive/filament-passport

Register the plugin in your panel provider:

use Webteractive\FilamentPassport\FilamentPassportPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentPassportPlugin::make(),
        ]);
}

Publish the config (optional):

php artisan vendor:publish --tag=filament-passport-config

Authorization Views

This package provides default OAuth consent views so you don't have to build them yourself:

  • Authorization — consent screen for OAuth authorization requests (v12 & v13)
  • Device Authorization — consent screen for device flow (v13 only)
  • Device User Code — form for entering a device code (v13 only)

Customizing Views

Publish the views to your app and edit them:

php artisan vendor:publish --tag=filament-passport-views

This copies the views to resources/views/vendor/filament-passport/ where they take precedence.

Using Your Own Views

You can override individual views via config — set a custom view name or null to skip registration for that view:

// config/filament-passport.php
'views' => [
    'enabled' => true,

    // Set to a custom view name, or null to skip
    'authorization' => 'my-custom-views.authorize',
    'device_authorization' => 'filament-passport::device.authorize',
    'device_user_code' => 'filament-passport::device.user-code',
],

For example, Laravel MCP requires its own authorization view for AI agent OAuth consent. Set authorization to null so this package skips it, then register the MCP view in your AppServiceProvider:

// config/filament-passport.php
'views' => [
    'enabled' => true,

    'authorization' => null, // Let MCP handle this
    'device_authorization' => 'filament-passport::device.authorize',
    'device_user_code' => 'filament-passport::device.user-code',
],
// app/Providers/AppServiceProvider.php
use Laravel\Passport\Passport;

public function boot(): void
{
    Passport::authorizationView(fn ($parameters) => view('mcp.authorize', $parameters));
}

To skip all view bindings entirely:

// config/filament-passport.php
'views' => [
    'enabled' => false,
],

Configuration

Toggle Resources

Disable any resource via config or fluently on the plugin:

// config/filament-passport.php
'resources' => [
    'client'       => ['enabled' => true],
    'access_token' => ['enabled' => true],
    'auth_code'    => ['enabled' => false],
],
// Or in your panel provider
FilamentPassportPlugin::make()
    ->clients()
    ->accessTokens()
    ->authCodes(false),

Navigation

// config/filament-passport.php
'navigation' => [
    'group' => 'OAuth',
    'sort'  => null,
],

Access Control

The plugin checks authorization in this order:

  1. Gate — if a viewFilamentPassport gate is defined, it is used.
  2. Callback — a closure passed via canAccess().
  3. Default — open access (returns true).
// Gate
Gate::define('viewFilamentPassport', fn ($user) => $user->isAdmin());

// Or callback
FilamentPassportPlugin::make()
    ->canAccess(fn () => auth()->user()->isAdmin()),

Supported Grant Profiles

Profile Confidential Redirect URIs Device Flow
Authorization Code configurable required optional
Authorization Code (PKCE) no required no
Device Authorization (v13 only) configurable no yes
Password configurable no no
Implicit no required no
Client Credentials yes no no

Testing

composer test

License

MIT. See LICENSE for details.

webteractive/filament-passport 适用场景与选型建议

webteractive/filament-passport 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 106 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「oauth」 「laravel」 「passport」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 webteractive/filament-passport 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webteractive/filament-passport 我们能提供哪些服务?
定制开发 / 二次开发

基于 webteractive/filament-passport 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-04