Commit 2acb0b8
committed
feat(cognito-idp): make TOTP MFA work
Implement TOTP MFA using the existing cryptography API.
This allows clients to behave correctly and use proper TOTP validation
compared with previously where the UserCode was not handled.
Warning: this implementation still uses the fixed constant "secret" and
therefore should not be considered for anything other than testing.
A solution implementing "real" TOTP was considered but would need
storing the secret temporarily in the session during the auth process
but the session object is unfortunately a tuple at this time.1 parent b74184d commit 2acb0b8
File tree
4 files changed
+52
-10
lines changed- moto/cognitoidp
- tests/test_cognitoidp
4 files changed
+52
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
2187 | 2188 | | |
2188 | 2189 | | |
2189 | 2190 | | |
2190 | | - | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2191 | 2194 | | |
2192 | 2195 | | |
2193 | 2196 | | |
| 2197 | + | |
2194 | 2198 | | |
2195 | 2199 | | |
2196 | 2200 | | |
2197 | 2201 | | |
2198 | 2202 | | |
2199 | 2203 | | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
2200 | 2207 | | |
2201 | 2208 | | |
2202 | 2209 | | |
| |||
2208 | 2215 | | |
2209 | 2216 | | |
2210 | 2217 | | |
| 2218 | + | |
| 2219 | + | |
2211 | 2220 | | |
2212 | 2221 | | |
2213 | 2222 | | |
| |||
2453 | 2462 | | |
2454 | 2463 | | |
2455 | 2464 | | |
2456 | | - | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
2457 | 2468 | | |
2458 | | - | |
| 2469 | + | |
2459 | 2470 | | |
2460 | 2471 | | |
2461 | 2472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
588 | 589 | | |
589 | | - | |
| 590 | + | |
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5248 | 5248 | | |
5249 | 5249 | | |
5250 | 5250 | | |
5251 | | - | |
| 5251 | + | |
| 5252 | + | |
| 5253 | + | |
| 5254 | + | |
| 5255 | + | |
5252 | 5256 | | |
5253 | | - | |
| 5257 | + | |
5254 | 5258 | | |
5255 | 5259 | | |
5256 | 5260 | | |
| |||
5332 | 5336 | | |
5333 | 5337 | | |
5334 | 5338 | | |
5335 | | - | |
5336 | | - | |
| 5339 | + | |
| 5340 | + | |
| 5341 | + | |
| 5342 | + | |
| 5343 | + | |
| 5344 | + | |
5337 | 5345 | | |
5338 | 5346 | | |
5339 | 5347 | | |
| |||
5368 | 5376 | | |
5369 | 5377 | | |
5370 | 5378 | | |
5371 | | - | |
5372 | | - | |
| 5379 | + | |
| 5380 | + | |
| 5381 | + | |
| 5382 | + | |
| 5383 | + | |
5373 | 5384 | | |
5374 | 5385 | | |
5375 | 5386 | | |
| |||
0 commit comments