1 | <?php |
||
17 | class Google2FA extends Google2FAService |
||
18 | { |
||
19 | use Auth; |
||
20 | use Config; |
||
21 | use Request; |
||
22 | use Session; |
||
23 | protected $qrCodeBackend; |
||
24 | |||
25 | /** |
||
26 | * Construct the correct backend. |
||
27 | */ |
||
28 | 15 | protected function constructBackend(): void |
|
45 | |||
46 | /** |
||
47 | * Set the QRCode Backend. |
||
48 | * |
||
49 | * @param string $qrCodeBackend |
||
50 | * |
||
51 | * @return self |
||
52 | */ |
||
53 | 1 | public function setQrCodeBackend(string $qrCodeBackend) |
|
59 | |||
60 | /** |
||
61 | * Authenticator constructor. |
||
62 | * |
||
63 | * @param IlluminateRequest $request |
||
64 | */ |
||
65 | 15 | public function __construct(IlluminateRequest $request) |
|
71 | |||
72 | /** |
||
73 | * Authenticator boot. |
||
74 | * |
||
75 | * @param $request |
||
76 | * |
||
77 | * @return Google2FA |
||
78 | */ |
||
79 | 15 | public function boot($request) |
|
85 | |||
86 | /** |
||
87 | * The QRCode Backend. |
||
88 | * |
||
89 | * @return mixed |
||
90 | */ |
||
91 | 15 | public function getQRCodeBackend() |
|
96 | |||
97 | /** |
||
98 | * Get the user Google2FA secret. |
||
99 | * |
||
100 | * @throws InvalidSecretKey |
||
101 | * |
||
102 | * @return mixed |
||
103 | */ |
||
104 | 10 | protected function getGoogle2FASecretKey() |
|
108 | |||
109 | /** |
||
110 | * Check if the 2FA is activated for the user. |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | 10 | public function isActivated() |
|
120 | |||
121 | /** |
||
122 | * Store the old OTP timestamp. |
||
123 | * |
||
124 | * @param $key |
||
125 | * |
||
126 | * @return mixed |
||
127 | */ |
||
128 | 5 | protected function storeOldTimestamp($key) |
|
134 | |||
135 | /** |
||
136 | * Get the previous OTP timestamp. |
||
137 | * |
||
138 | * @return null|mixed |
||
139 | */ |
||
140 | 6 | protected function getOldTimestamp() |
|
146 | |||
147 | /** |
||
148 | * Keep this OTP session alive. |
||
149 | */ |
||
150 | 4 | protected function keepAlive() |
|
156 | |||
157 | /** |
||
158 | * Get minutes since last activity. |
||
159 | * |
||
160 | * @return int |
||
161 | */ |
||
162 | 1 | protected function minutesSinceLastActivity() |
|
168 | |||
169 | /** |
||
170 | * Check if no user is authenticated using OTP. |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | 9 | protected function noUserIsAuthenticated() |
|
178 | |||
179 | /** |
||
180 | * Check if OTP has expired. |
||
181 | * |
||
182 | * @return bool |
||
183 | */ |
||
184 | 4 | protected function passwordExpired() |
|
198 | |||
199 | /** |
||
200 | * Verifies, in the current session, if a 2fa check has already passed. |
||
201 | * |
||
202 | * @return bool |
||
203 | */ |
||
204 | 9 | protected function twoFactorAuthStillValid() |
|
210 | |||
211 | /** |
||
212 | * Check if the module is enabled. |
||
213 | * |
||
214 | * @return mixed |
||
215 | */ |
||
216 | 9 | protected function isEnabled() |
|
220 | |||
221 | /** |
||
222 | * Set current auth as valid. |
||
223 | */ |
||
224 | 5 | public function login() |
|
230 | |||
231 | /** |
||
232 | * OTP logout. |
||
233 | */ |
||
234 | 3 | public function logout() |
|
242 | |||
243 | /** |
||
244 | * Update the current auth time. |
||
245 | */ |
||
246 | 5 | protected function updateCurrentAuthTime() |
|
250 | |||
251 | /** |
||
252 | * Verify the OTP. |
||
253 | * |
||
254 | * @param $secret |
||
255 | * @param $one_time_password |
||
256 | * |
||
257 | * @return mixed |
||
258 | */ |
||
259 | 6 | public function verifyGoogle2FA($secret, $one_time_password) |
|
269 | |||
270 | /** |
||
271 | * Verify the OTP and store the timestamp. |
||
272 | * |
||
273 | * @param $one_time_password |
||
274 | * |
||
275 | * @return mixed |
||
276 | */ |
||
277 | 5 | protected function verifyAndStoreOneTimePassword($one_time_password) |
|
286 | } |
||
287 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.