Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
Security
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace Config;
4
5use CodeIgniter\Config\BaseConfig;
6
7class Security extends BaseConfig
8{
9    /**
10     * --------------------------------------------------------------------------
11     * CSRF Protection Method
12     * --------------------------------------------------------------------------
13     *
14     * Protection Method for Cross Site Request Forgery protection.
15     *
16     * @var string 'cookie' or 'session'
17     */
18    public string $csrfProtection = 'cookie';
19
20    /**
21     * --------------------------------------------------------------------------
22     * CSRF Token Randomization
23     * --------------------------------------------------------------------------
24     *
25     * Randomize the CSRF Token for added security.
26     */
27    public bool $tokenRandomize = false;
28
29    /**
30     * --------------------------------------------------------------------------
31     * CSRF Token Name
32     * --------------------------------------------------------------------------
33     *
34     * Token name for Cross Site Request Forgery protection.
35     */
36    public string $tokenName = 'csrf_test_name';
37
38    /**
39     * --------------------------------------------------------------------------
40     * CSRF Header Name
41     * --------------------------------------------------------------------------
42     *
43     * Header name for Cross Site Request Forgery protection.
44     */
45    public string $headerName = 'X-CSRF-TOKEN';
46
47    /**
48     * --------------------------------------------------------------------------
49     * CSRF Cookie Name
50     * --------------------------------------------------------------------------
51     *
52     * Cookie name for Cross Site Request Forgery protection.
53     */
54    public string $cookieName = 'csrf_cookie_name';
55
56    /**
57     * --------------------------------------------------------------------------
58     * CSRF Expires
59     * --------------------------------------------------------------------------
60     *
61     * Expiration time for Cross Site Request Forgery protection cookie.
62     *
63     * Defaults to two hours (in seconds).
64     */
65    public int $expires = 7200;
66
67    /**
68     * --------------------------------------------------------------------------
69     * CSRF Regenerate
70     * --------------------------------------------------------------------------
71     *
72     * Regenerate CSRF Token on every submission.
73     */
74    public bool $regenerate = true;
75
76    /**
77     * --------------------------------------------------------------------------
78     * CSRF Redirect
79     * --------------------------------------------------------------------------
80     *
81     * Redirect to previous page with error on failure.
82     *
83     * @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
84     */
85    public bool $redirect = (ENVIRONMENT === 'production');
86}