ci4

Форк
0
/
Filters.php 
107 строк · 3.2 Кб
1
<?php
2

3
namespace Config;
4

5
use CodeIgniter\Config\Filters as BaseFilters;
6
use CodeIgniter\Filters\Cors;
7
use CodeIgniter\Filters\CSRF;
8
use CodeIgniter\Filters\DebugToolbar;
9
use CodeIgniter\Filters\ForceHTTPS;
10
use CodeIgniter\Filters\Honeypot;
11
use CodeIgniter\Filters\InvalidChars;
12
use CodeIgniter\Filters\PageCache;
13
use CodeIgniter\Filters\PerformanceMetrics;
14
use CodeIgniter\Filters\SecureHeaders;
15

16
class Filters extends BaseFilters
17
{
18
    /**
19
     * Configures aliases for Filter classes to
20
     * make reading things nicer and simpler.
21
     *
22
     * @var array<string, class-string|list<class-string>>
23
     *
24
     * [filter_name => classname]
25
     * or [filter_name => [classname1, classname2, ...]]
26
     */
27
    public array $aliases = [
28
        'csrf'          => CSRF::class,
29
        'toolbar'       => DebugToolbar::class,
30
        'honeypot'      => Honeypot::class,
31
        'invalidchars'  => InvalidChars::class,
32
        'secureheaders' => SecureHeaders::class,
33
        'cors'          => Cors::class,
34
        'forcehttps'    => ForceHTTPS::class,
35
        'pagecache'     => PageCache::class,
36
        'performance'   => PerformanceMetrics::class,
37
    ];
38

39
    /**
40
     * List of special required filters.
41
     *
42
     * The filters listed here are special. They are applied before and after
43
     * other kinds of filters, and always applied even if a route does not exist.
44
     *
45
     * Filters set by default provide framework functionality. If removed,
46
     * those functions will no longer work.
47
     *
48
     * @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
49
     *
50
     * @var array{before: list<string>, after: list<string>}
51
     */
52
    public array $required = [
53
        'before' => [
54
            'forcehttps', // Force Global Secure Requests
55
            'pagecache',  // Web Page Caching
56
        ],
57
        'after' => [
58
            'pagecache',   // Web Page Caching
59
            'performance', // Performance Metrics
60
            'toolbar',     // Debug Toolbar
61
        ],
62
    ];
63

64
    /**
65
     * List of filter aliases that are always
66
     * applied before and after every request.
67
     *
68
     * @var array<string, array<string, array<string, string>>>|array<string, list<string>>
69
     */
70
    public array $globals = [
71
        'before' => [
72
            // 'honeypot',
73
            // 'csrf',
74
            // 'invalidchars',
75
        ],
76
        'after' => [
77
            // 'honeypot',
78
            // 'secureheaders',
79
        ],
80
    ];
81

82
    /**
83
     * List of filter aliases that works on a
84
     * particular HTTP method (GET, POST, etc.).
85
     *
86
     * Example:
87
     * 'POST' => ['foo', 'bar']
88
     *
89
     * If you use this, you should disable auto-routing because auto-routing
90
     * permits any HTTP method to access a controller. Accessing the controller
91
     * with a method you don't expect could bypass the filter.
92
     *
93
     * @var array<string, list<string>>
94
     */
95
    public array $methods = [];
96

97
    /**
98
     * List of filter aliases that should run on any
99
     * before or after URI patterns.
100
     *
101
     * Example:
102
     * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
103
     *
104
     * @var array<string, array<string, list<string>>>
105
     */
106
    public array $filters = [];
107
}
108

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.