Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
CsrfToken.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\utils\http\session\protection
;
4
13
class
CsrfToken
{
14
private
$name
;
15
private
$value
;
16
17
public
function
__construct
($size = 32) {
18
$this->name = $this->
generate
( $size );
19
$this->value = $this->
generate
( $size );
20
}
21
22
private
function
generate
($size): string {
23
$bytes = \random_bytes ( $size );
24
return \rtrim ( \strtr ( \base64_encode ( $bytes ),
'+/'
,
'-_'
),
'='
);
25
}
26
31
public
function
getName
() {
32
return
$this->name;
33
}
34
39
public
function
getValue
() {
40
return
$this->value;
41
}
42
}
43
Ubiquity\utils\http\session\protection\CsrfToken
Ubiquity\utils\http\session\protection$CsrfToken This class is part of Ubiquity.
Definition
CsrfToken.php:13
Ubiquity\utils\http\session\protection\CsrfToken\$value
$value
Definition
CsrfToken.php:15
Ubiquity\utils\http\session\protection\CsrfToken\getName
getName()
Definition
CsrfToken.php:31
Ubiquity\utils\http\session\protection\CsrfToken\__construct
__construct($size=32)
Definition
CsrfToken.php:17
Ubiquity\utils\http\session\protection\CsrfToken\$name
$name
Definition
CsrfToken.php:14
Ubiquity\utils\http\session\protection\CsrfToken\generate
generate($size)
Definition
CsrfToken.php:22
Ubiquity\utils\http\session\protection\CsrfToken\getValue
getValue()
Definition
CsrfToken.php:39
Ubiquity\utils\http\session\protection
Definition
CsrfToken.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
utils
http
session
protection
CsrfToken.php
Generated on Sun Dec 10 2023 15:04:27 for
Ubiquity
by
doxygen
1.9.8