承接 bencolmer/laravel-fit-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bencolmer/laravel-fit-validator

最新稳定版本:1.2.0

Composer 安装命令:

composer require bencolmer/laravel-fit-validator

包简介

Validate Atlassian Forge Invocation Tokens (FITs) in Laravel

README 文档

README

Latest Version on Packagist

This package allows you to validate and use Atlassian Forge Invocation Tokens (FITs) in Laravel.

Installation

  1. Install the package via composer:
composer require bencolmer/laravel-fit-validator
  1. Configure .env values:
FIT_APP_ID="example:id::app/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" # The ID of your Forge application
FIT_JWKS_URL="https://forge.cdn.prod.atlassian-dev.net/.well-known/jwks.json" # The JWKS URL for your Forge application
  1. Add the fit middleware to any routes that should validate Forge Invocation Tokens.
Route::middleware('fit')->group(function () {
    //
});

Token Usage

The fit middleware will validate the Forge Invocation Token and add the validated payload to the request input array.

Example:

// in routes/api.php

Route::middleware('fit')->group(function () {
    Route::get('example', [ExampleController::class, 'index']);
});
// in app/Http/Controllers/ExampleController.php

use Illuminate\Http\Request;

class ExampleController extends Controller
{
    public function index(Request $request)
    {
        $fit = $request->input('fit');

        // ...
    }
}

Advanced Usage

You can configure the package to validate FIT tokens from multiple Forge applications:

  1. Publish package configuration
php artisan vendor:publish --provider="BenColmer\LaravelFITValidator\Providers\ServiceProvider"
  1. Add your Forge application details to the applications array in config/fit.php:
// ...

'applications' => [
    // ...

    // details for your other application
    'otherApp' => [
        'appId' => (string) env('FIT_OTHER_APP_ID', ''),
        'jwksUrl' => (string) env('FIT_OTHER_JWKS_URL', ''),
    ]
],
  1. Update the fit middleware to use the configuration for your new application
// in routes/api.php

Route::middleware('fit')->group(function () {
    // validate FITs using the "default" application config
});

Route::middleware('fit:otherApp')->group(function () {
    // validate FITs using the "otherApp" application config
});

Additional Configuration

The following options can also be modified by publishing the package configuration:

Name Default Value Description
middlewareAlias fit The alias for the FIT validation middleware
issuer forge/invocation-token The expected Forge Invocation Token issuer
jwksCacheDuration 5 minutes The cache duration for fetched JSON Web Key Sets. Setting this to null will disable caching

Testing

Run tests via PHPUnit:

./vendor/bin/phpunit

Credits

License

Laravel FIT Validator is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固