1 | <?php |
||
19 | class Authenticator extends Google2FA |
||
20 | { |
||
21 | use ErrorBag, Input, Response, Session; |
||
22 | |||
23 | /** |
||
24 | * The current password. |
||
25 | * |
||
26 | * @var |
||
27 | */ |
||
28 | protected $password; |
||
29 | |||
30 | /** |
||
31 | * Authenticator constructor. |
||
32 | * |
||
33 | * @param \Illuminate\Http\Request $request |
||
34 | */ |
||
35 | 9 | public function __construct(IlluminateRequest $request) |
|
39 | |||
40 | /** |
||
41 | * Authenticator boot. |
||
42 | * |
||
43 | * @param $request |
||
44 | * |
||
45 | * @return Google2FA |
||
46 | */ |
||
47 | 9 | public function boot($request) |
|
53 | |||
54 | /** |
||
55 | * Authenticator boot for API usage. |
||
56 | * |
||
57 | * @param $request |
||
58 | * |
||
59 | * @return Google2FA |
||
60 | */ |
||
61 | 1 | public function bootStateless($request) |
|
69 | |||
70 | /** |
||
71 | * Removes expired tokens from the database. |
||
72 | */ |
||
73 | 7 | public function cleanupTokens(): void |
|
80 | |||
81 | /** |
||
82 | * Fire login (success or failed). |
||
83 | * |
||
84 | * @param $succeeded |
||
85 | * |
||
86 | */ |
||
87 | 4 | private function fireLoginEvent($succeeded) |
|
97 | |||
98 | /** |
||
99 | * Get the OTP from user input. |
||
100 | * |
||
101 | * @throws InvalidOneTimePassword |
||
102 | * |
||
103 | * @return mixed |
||
104 | */ |
||
105 | 5 | protected function getOneTimePassword() |
|
119 | |||
120 | /** |
||
121 | * Check if the current use is authenticated via OTP. |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | 9 | public function isAuthenticated() |
|
129 | |||
130 | /** |
||
131 | * @return bool |
||
132 | */ |
||
133 | 8 | public function hasValidCookieToken(): bool |
|
157 | |||
158 | /** |
||
159 | * Check if it is already logged in or passable without checking for an OTP. |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | 9 | protected function canPassWithoutCheckingOTP() |
|
171 | |||
172 | /** |
||
173 | * Check if the input OTP is valid. Returns one of the possible OTP_STATUS codes: |
||
174 | * 'empty', 'valid' or 'invalid'. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | 9 | protected function checkOTP() |
|
195 | |||
196 | /** |
||
197 | * Verify the OTP. |
||
198 | * |
||
199 | * @throws InvalidOneTimePassword |
||
200 | * |
||
201 | * @return mixed |
||
202 | */ |
||
203 | 5 | protected function verifyOneTimePassword() |
|
207 | } |
||
208 |