88 lines
2.3 KiB
PHP
88 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Config\Filters as BaseFilters;
|
|
use CodeIgniter\Filters\Cors;
|
|
use CodeIgniter\Filters\CSRF;
|
|
use CodeIgniter\Filters\DebugToolbar;
|
|
use CodeIgniter\Filters\ForceHTTPS;
|
|
use CodeIgniter\Filters\Honeypot;
|
|
use CodeIgniter\Filters\InvalidChars;
|
|
use CodeIgniter\Filters\PageCache;
|
|
use CodeIgniter\Filters\PerformanceMetrics;
|
|
use CodeIgniter\Filters\SecureHeaders;
|
|
|
|
class Filters extends BaseFilters
|
|
{
|
|
/**
|
|
* Configures aliases for Filter classes to
|
|
* make reading things nicer and simpler.
|
|
*
|
|
* @var array<string, class-string|list<class-string>>
|
|
*/
|
|
public array $aliases = [
|
|
'csrf' => CSRF::class,
|
|
'toolbar' => DebugToolbar::class,
|
|
'honeypot' => Honeypot::class,
|
|
'invalidchars' => InvalidChars::class,
|
|
'secureheaders' => SecureHeaders::class,
|
|
'cors' => Cors::class,
|
|
'forcehttps' => ForceHTTPS::class,
|
|
'pagecache' => PageCache::class,
|
|
'performance' => PerformanceMetrics::class,
|
|
'auth' => \App\Filters\AuthFilter::class,
|
|
];
|
|
|
|
/**
|
|
* List of special required filters.
|
|
*
|
|
* @var array{before: list<string>, after: list<string>}
|
|
*/
|
|
public array $required = [
|
|
'before' => [
|
|
'forcehttps',
|
|
'pagecache',
|
|
],
|
|
'after' => [
|
|
'pagecache',
|
|
'performance',
|
|
'toolbar',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* List of filter aliases that are always
|
|
* applied before and after every request.
|
|
*
|
|
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
|
|
*/
|
|
public array $globals = [
|
|
'before' => [
|
|
// 'honeypot',
|
|
// 'csrf',
|
|
// 'invalidchars',
|
|
],
|
|
'after' => [
|
|
// 'honeypot',
|
|
// 'secureheaders',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* List of filter aliases that works on a
|
|
* particular HTTP method (GET, POST, etc.).
|
|
*
|
|
* @var array<string, list<string>>
|
|
*/
|
|
public array $methods = [];
|
|
|
|
/**
|
|
* List of filter aliases that should run on any
|
|
* before or after URI patterns.
|
|
*
|
|
* @var array<string, array<string, list<string>>>
|
|
*/
|
|
public array $filters = [];
|
|
}
|