| Code Coverage
| Lines | Functions and Methods | Classes and Traits
Total |  | n/a | 0 / 0 |  | n/a | 0 / 0 | CRAP |  | n/a | 0 / 0
Filters |  | n/a | 0 / 0 |  | n/a | 0 / 0 | 0 |  | n/a | 0 / 0

1 | <?php
2 |
3 | namespace Config;
4 |
5 | use App\Filters\AppRoleFilter;
6 | use CodeIgniter\Config\Filters as BaseFilters;
7 | use CodeIgniter\Filters\Cors;
8 | use CodeIgniter\Filters\CSRF;
9 | use CodeIgniter\Filters\DebugToolbar;
10 | use CodeIgniter\Filters\ForceHTTPS;
11 | use CodeIgniter\Filters\Honeypot;
12 | use CodeIgniter\Filters\InvalidChars;
13 | use CodeIgniter\Filters\PageCache;
14 | use CodeIgniter\Filters\PerformanceMetrics;
15 | use CodeIgniter\Filters\SecureHeaders;
16 |
17 | class Filters extends BaseFilters
18 | {
19 | /**
20 | * Configures aliases for Filter classes to
21 | * make reading things nicer and simpler.
22 | *
23 | * @var array<string, class-string|list<class-string>>
24 | *
25 | * [filter_name => classname]
26 | * or [filter_name => [classname1, classname2, ...]]
27 | */
28 | public array $aliases = [
29 | 'csrf' => CSRF::class,
30 | 'toolbar' => DebugToolbar::class,
31 | 'honeypot' => Honeypot::class,
32 | 'invalidchars' => InvalidChars::class,
33 | 'secureheaders' => SecureHeaders::class,
34 | 'cors' => Cors::class,
35 | 'forcehttps' => ForceHTTPS::class,
36 | 'pagecache' => PageCache::class,
37 | 'performance' => PerformanceMetrics::class,
38 | 'session' => \CodeIgniter\Shield\Filters\SessionAuth::class,
39 | 'role' => AppRoleFilter::class,
40 | ];
41 |
42 | /**
43 | * List of special required filters.
44 | *
45 | * The filters listed here are special. They are applied before and after
46 | * other kinds of filters, and always applied even if a route does not exist.
47 | *
48 | * Filters set by default provide framework functionality. If removed,
49 | * those functions will no longer work.
50 | *
51 | * @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
52 | *
53 | * @var array{before: list<string>, after: list<string>}
54 | */
55 | public array $required = [
56 | 'before' => [],
57 | 'after' => [
58 | 'performance', // Performance Metrics
59 | 'toolbar', // Debug Toolbar
60 | ],
61 | ];
62 |
63 | /**
64 | * List of filter aliases that are always
65 | * applied before and after every request.
66 | *
67 | * @var array{
68 | * before: array<string, array{except: list<string>|string}>|list<string>,
69 | * after: array<string, array{except: list<string>|string}>|list<string>
70 | * }
71 | */
72 | public array $globals = [
73 | 'before' => [
74 | // 'honeypot',
75 | // 'csrf',
76 | // 'invalidchars',
77 | ],
78 | 'after' => [
79 | // 'honeypot',
80 | // 'secureheaders',
81 | ],
82 | ];
83 |
84 | /**
85 | * List of filter aliases that works on a
86 | * particular HTTP method (GET, POST, etc.).
87 | *
88 | * Example:
89 | * 'POST' => ['foo', 'bar']
90 | *
91 | * If you use this, you should disable auto-routing because auto-routing
92 | * permits any HTTP method to access a controller. Accessing the controller
93 | * with a method you don't expect could bypass the filter.
94 | *
95 | * @var array<string, list<string>>
96 | */
97 | public array $methods = [];
98 |
99 | /**
100 | * List of filter aliases that should run on any
101 | * before or after URI patterns.
102 | *
103 | * Example:
104 | * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
105 | *
106 | * @var array<string, array<string, list<string>>>
107 | */
108 | public array $filters = [];
109 | }