1 | <?php |
||
18 | class Authenticator extends Google2FA |
||
19 | { |
||
20 | use ErrorBag, Input, Response, Session; |
||
21 | |||
22 | /** |
||
23 | * The current password. |
||
24 | * |
||
25 | * @var |
||
26 | */ |
||
27 | protected $password; |
||
28 | |||
29 | /** |
||
30 | * Authenticator constructor. |
||
31 | * |
||
32 | * @param \Illuminate\Http\Request $request |
||
33 | */ |
||
34 | 1 | public function __construct(IlluminateRequest $request) |
|
38 | |||
39 | /** |
||
40 | * Authenticator boot. |
||
41 | * |
||
42 | * @param $request |
||
43 | * |
||
44 | * @return Google2FA |
||
45 | */ |
||
46 | 1 | public function boot($request) |
|
52 | |||
53 | /** |
||
54 | * Authenticator boot for API usage. |
||
55 | * |
||
56 | * @param $request |
||
57 | * |
||
58 | * @return Google2FA |
||
59 | */ |
||
60 | public function bootStateless($request) |
||
68 | |||
69 | /** |
||
70 | * Removes expired tokens from the database. |
||
71 | */ |
||
72 | 1 | public function cleanupTokens(): void |
|
76 | |||
77 | /** |
||
78 | * Fire login (success or failed). |
||
79 | * |
||
80 | * @param $succeeded |
||
81 | * |
||
82 | */ |
||
83 | private function fireLoginEvent($succeeded) |
||
93 | |||
94 | /** |
||
95 | * Get the OTP from user input. |
||
96 | * |
||
97 | * @throws InvalidOneTimePassword |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | protected function getOneTimePassword() |
||
115 | |||
116 | /** |
||
117 | * Check if the current use is authenticated via OTP. |
||
118 | * |
||
119 | * @return bool |
||
120 | */ |
||
121 | 1 | public function isAuthenticated() |
|
125 | |||
126 | /** |
||
127 | * @return bool |
||
128 | */ |
||
129 | 1 | public function hasValidCookieToken(): bool |
|
149 | |||
150 | /** |
||
151 | * Check if it is already logged in or passable without checking for an OTP. |
||
152 | * |
||
153 | * @return bool |
||
154 | */ |
||
155 | 1 | protected function canPassWithoutCheckingOTP() |
|
163 | |||
164 | /** |
||
165 | * Check if the input OTP is valid. Returns one of the possible OTP_STATUS codes: |
||
166 | * 'empty', 'valid' or 'invalid'. |
||
167 | * |
||
168 | * @return string |
||
169 | */ |
||
170 | 1 | protected function checkOTP() |
|
187 | |||
188 | /** |
||
189 | * Verify the OTP. |
||
190 | * |
||
191 | * @throws InvalidOneTimePassword |
||
192 | * |
||
193 | * @return mixed |
||
194 | */ |
||
195 | protected function verifyOneTimePassword() |
||
199 | } |
||
200 |