1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* The authentication token object. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace CryptoManana\DataStructures; |
8
|
|
|
|
9
|
|
|
use CryptoManana\Core\Abstractions\DataStructures\AbstractBasicStructure as BasicDataStructure; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class AuthenticationToken - The authentication token structure. |
13
|
|
|
* |
14
|
|
|
* @package CryptoManana\DataStructures |
15
|
|
|
* |
16
|
|
|
* @property string $tokenData The raw/plain token. |
17
|
|
|
* @property string $cipherData The encrypted token. |
18
|
|
|
*/ |
19
|
|
|
class AuthenticationToken extends BasicDataStructure |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* The raw token data property storage. |
23
|
|
|
* |
24
|
|
|
* @var string The raw/plain token. |
25
|
|
|
*/ |
26
|
|
|
protected $tokenData = ''; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The encrypted token property storage. |
30
|
|
|
* |
31
|
|
|
* @var string The encrypted token. |
32
|
|
|
*/ |
33
|
|
|
protected $cipherData = ''; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Authentication token constructor. |
37
|
|
|
* |
38
|
|
|
* @param string $rawToken The raw token string. |
39
|
|
|
* @param string $encryptedToken The encrypted token string. |
40
|
|
|
* |
41
|
|
|
* @throws \Exception Validation errors. |
42
|
|
|
*/ |
43
|
14 |
|
public function __construct($rawToken = '', $encryptedToken = '') |
44
|
|
|
{ |
45
|
14 |
|
$this->__set('tokenData', $rawToken); |
46
|
14 |
|
$this->__set('cipherData', $encryptedToken); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Authentication token destructor |
51
|
|
|
*/ |
52
|
14 |
|
public function __destruct() |
53
|
|
|
{ |
54
|
14 |
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The authentication token string representation. |
58
|
|
|
* |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
2 |
|
public function __toString() |
62
|
|
|
{ |
63
|
2 |
|
return 'token : ' . $this->tokenData . ' | encrypted : ' . $this->cipherData; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|