1 | <?php |
||
5 | class Security |
||
6 | { |
||
7 | /** |
||
8 | * (UT 3.1) Password type: plain text. |
||
9 | */ |
||
10 | const PASSWORD_TYPE_TEXT = 0; |
||
11 | |||
12 | /** |
||
13 | * (UT 3.1) Password type: digest. |
||
14 | */ |
||
15 | const PASSWORD_TYPE_DIGEST = 1; |
||
16 | |||
17 | /** |
||
18 | * (UT 3.1) Password. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $password; |
||
23 | |||
24 | /** |
||
25 | * (UT 3.1) Password type: text or digest. |
||
26 | * |
||
27 | * @var int |
||
28 | */ |
||
29 | protected $passwordType = self::PASSWORD_TYPE_DIGEST; |
||
30 | |||
31 | /** |
||
32 | * (UT 3.1) Username. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $username; |
||
37 | |||
38 | /** |
||
39 | * (SMS 10) Add security timestamp. |
||
40 | * |
||
41 | * @var boolean |
||
42 | */ |
||
43 | protected $addTimestamp = true; |
||
44 | |||
45 | /** |
||
46 | * (UT 3.1) Username. |
||
47 | * |
||
48 | * @var \DateTime |
||
49 | */ |
||
50 | protected $timestamp; |
||
51 | |||
52 | /** |
||
53 | * (SMS 10) Security timestamp expires time in seconds. |
||
54 | * |
||
55 | * @var int |
||
56 | */ |
||
57 | protected $expires = 300; |
||
58 | |||
59 | /** |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getPassword() |
||
66 | |||
67 | /** |
||
68 | * @return \DateTime |
||
69 | */ |
||
70 | public function getTimestamp() |
||
74 | |||
75 | /** |
||
76 | * @param \DateTime $timestamp |
||
77 | */ |
||
78 | public function setTimestamp(\DateTime $timestamp) |
||
82 | |||
83 | /** |
||
84 | * @param string $password |
||
85 | * @param int $passwordType |
||
86 | */ |
||
87 | public function setPassword($password, $passwordType = self::PASSWORD_TYPE_DIGEST) |
||
92 | |||
93 | /** |
||
94 | * @return int |
||
95 | */ |
||
96 | public function getPasswordType() |
||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getUsername() |
||
108 | |||
109 | /** |
||
110 | * @param string $username |
||
111 | */ |
||
112 | public function setUsername($username) |
||
116 | |||
117 | /** |
||
118 | * @return bool |
||
119 | */ |
||
120 | public function isAddTimestamp() |
||
124 | |||
125 | /** |
||
126 | * @param bool $addTimestamp |
||
127 | */ |
||
128 | public function setAddTimestamp($addTimestamp) |
||
132 | |||
133 | /** |
||
134 | * @return int |
||
135 | */ |
||
136 | public function getExpires() |
||
140 | |||
141 | /** |
||
142 | * @param int $expires |
||
143 | */ |
||
144 | public function setExpires($expires) |
||
148 | |||
149 | |||
150 | } |
||
151 |