Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SessionTokenStorage.php
Go to the documentation of this file.
1
<?php
2
namespace
Ubiquity\security\csrf\storages
;
3
4
use
Ubiquity\utils\http\USession
;
5
6
class
SessionTokenStorage
implements
TokenStorageInterface
{
7
8
protected
$key
=
'_CSRF'
;
9
10
protected
function
getKey
($id) {
11
return
$this->key .
'/'
. $id;
12
}
13
14
public
function
__construct
(
string
$key
=
'_CSRF'
) {
15
$this->key =
$key
;
16
}
17
18
public
function
set
(
string
$id,
string
$token): void {
19
USession
::
set
($this->
getKey
($id), $token);
20
}
21
22
public
function
get
(
string
$id): ?string {
23
return
USession
::get($this->getKey($id));
24
}
25
26
public
function
exists
(
string
$id): bool {
27
return
USession
::exists($this->getKey($id));
28
}
29
30
public
function
remove
(
string
$id): ?string {
31
$v =
USession
::get($id);
32
USession::delete($this->getKey($id));
33
return
$v;
34
}
35
}
36
Ubiquity\security\csrf\storages\SessionTokenStorage
Definition
SessionTokenStorage.php:6
Ubiquity\security\csrf\storages\SessionTokenStorage\__construct
__construct(string $key='_CSRF')
Definition
SessionTokenStorage.php:14
Ubiquity\security\csrf\storages\SessionTokenStorage\getKey
getKey($id)
Definition
SessionTokenStorage.php:10
Ubiquity\security\csrf\storages\SessionTokenStorage\$key
$key
Definition
SessionTokenStorage.php:8
Ubiquity\security\csrf\storages\SessionTokenStorage\exists
exists(string $id)
Checks whether a token with the given token ID exists.
Definition
SessionTokenStorage.php:26
Ubiquity\security\csrf\storages\SessionTokenStorage\set
set(string $id, string $token)
Stores a CSRF token.
Definition
SessionTokenStorage.php:18
Ubiquity\utils\http\USession
Http Session utilities This class is part of Ubiquity.
Definition
USession.php:16
Ubiquity\security\csrf\storages\TokenStorageInterface
Definition
TokenStorageInterface.php:4
Ubiquity\security\csrf\storages
Definition
SessionTokenStorage.php:2
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity-security
src
Ubiquity
security
csrf
storages
SessionTokenStorage.php
Generated on Sun Dec 10 2023 15:04:10 for
Ubiquity
by
doxygen
1.9.8