3
declare(strict_types=1);
6
* This file is part of CodeIgniter 4 framework.
8
* (c) CodeIgniter Foundation <admin@codeigniter.com>
10
* For the full copyright and license information, please view
11
* the LICENSE file that was distributed with this source code.
14
namespace CodeIgniter\Security;
16
use CodeIgniter\HTTP\RequestInterface;
17
use CodeIgniter\Security\Exceptions\SecurityException;
20
* Expected behavior of a Security.
22
interface SecurityInterface
29
* @throws SecurityException
31
public function verify(RequestInterface $request);
34
* Returns the CSRF Hash.
36
public function getHash(): ?string;
39
* Returns the CSRF Token Name.
41
public function getTokenName(): string;
44
* Returns the CSRF Header Name.
46
public function getHeaderName(): string;
49
* Returns the CSRF Cookie Name.
51
public function getCookieName(): string;
54
* Check if request should be redirect on failure.
56
public function shouldRedirect(): bool;
61
* Tries to sanitize filenames in order to prevent directory traversal attempts
62
* and other security threats, which is particularly useful for files that
63
* were supplied via user input.
65
* If it is acceptable for the user input to include relative paths,
66
* e.g. file/in/some/approved/folder.txt, you can set the second optional
67
* parameter, $relative_path to TRUE.
69
* @param string $str Input file name
70
* @param bool $relativePath Whether to preserve paths
72
public function sanitizeFilename(string $str, bool $relativePath = false): string;