定制 teraone/laravel-cloudflare-zero-trust-middleware 二次开发

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

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

teraone/laravel-cloudflare-zero-trust-middleware

最新稳定版本:1.3.1

Composer 安装命令:

composer require teraone/laravel-cloudflare-zero-trust-middleware

包简介

Middleware to secure certain routes with Cloudflare Zero Trust

README 文档

README

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

Installation

You can install the package via composer:

composer require teraone/laravel-cloudflare-zero-trust-middleware

Configuration

Publish the config file with:

php artisan vendor:publish --tag="cloudflare-zero-trust-middleware-config"

This is the content of the published config file:

return [
    /*
     |--------------------------------------------------------------------------
     | Cloudflare Team Name
     |--------------------------------------------------------------------------
     |
     | Here you should define the name of your Cloudflare Team Account.
     | Not sure? Open https://one.dash.cloudflare.com/
     | It will be the name on which you click.
     |
     */
    'cloudflare_team_name' => env('CLOUDFLARE_TEAM_NAME'),

    /*
     |--------------------------------------------------------------------------
     | Cloudflare Zero Trust / Application Audience Tag
     |--------------------------------------------------------------------------
     |
     | Please enter the Application Audience Tag which you want to protect.
     | Open the Zero Trust Dashboard at https://one.dash.cloudflare.com/:
     | Access > Applications: Select "Configure" for your application.
     | On the overview tab, copy the "Application Audience (AUD) Tag".
     |
     */
    'cloudflare_zero_trust_application_audience_tag' => env('CLOUDFLARE_ZERO_TRUST_APPLICATION_AUDIENCE_TAG'),

    /*
     |--------------------------------------------------------------------------
     | Use certificate cache
     |--------------------------------------------------------------------------
     |
     | Should it cache the cloudflare certificates.
     |
     */
    'cache' => true,

    /*
     |--------------------------------------------------------------------------
     | Certificate cache TTL
     |--------------------------------------------------------------------------
     |
     | How long should we cache your public cloudflare certificates? In seconds.
     | The certificate cache will be flushed when a new certificate is detected.
     |
     */
    'cache_ttl' => 60 * 60 * 24,

    /*
     |--------------------------------------------------------------------------
     | Disable the middleware on these environments
     |--------------------------------------------------------------------------
     |
     | Most likely you do not have cloudflare available during development.
     | Use this setting to bypass the middleware for specific environments.
     |
     */
    'disabled_environments' => [
        'local',
    ],
];

Usage

Add the middleware to the routes you want to protect.

// with shorthand alias
Route::get('/protected', function(){ return 'Protected by Cloudflare Zero trust ✅';})
    ->middleware('cloudflare-zero-trust');

// OR: Use Class directly    
Route::get('/also-secure', function(){ return 'Also protected by Cloudflare Zero trust ✅';})
    ->middleware(\Teraone\ZeroTrustMiddleware\ZeroTrustMiddleware\ZeroTrustMiddleware::class);
    

Testing

composer test

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

License

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

Support Spatie

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

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