Repository navigation
Commit b09bad3
authored
Report a fresh access token's whole lifetime in expires_in (#3288)
* Report a fresh access token's whole lifetime in expires_in
The token response counted expires_in down from the clock at response
time and truncated it, so a 1-hour token minted a few milliseconds
earlier was reported as 3599 seconds. Clients that require an hour-long
token refuse a provider that says so.
A token minted or rotated by the instance answering now reports its
lifetime from issuance, with the expiry taken from the same clock
reading, so a 1-hour token reports 3600 and a delegated one its whole
capped 300. A token loaded later, such as a refresh retried within the
grace window, still reports what it has left, rounded up. No TTL
changes.
* Clear a token's issuance time when it reloads
A reloaded token reads its expiry afresh, so it must report what it has
left, not the lifetime it was minted with. A virtual attribute is reset
by reload; an instance variable outlived it.1 parent 0d5fbef commit b09bad3
4 files changed
Lines changed: 60 additions & 9 deletions
File tree
- app/models/identity
- test
- integration
- models/identity
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
352 | 357 | | |
353 | 358 | | |
354 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
355 | 367 | | |
356 | | - | |
| 368 | + | |
357 | 369 | | |
358 | 370 | | |
359 | 371 | | |
| |||
377 | 389 | | |
378 | 390 | | |
379 | 391 | | |
| 392 | + | |
380 | 393 | | |
381 | 394 | | |
382 | | - | |
| 395 | + | |
383 | 396 | | |
384 | 397 | | |
385 | 398 | | |
386 | 399 | | |
387 | 400 | | |
388 | 401 | | |
389 | 402 | | |
390 | | - | |
| 403 | + | |
391 | 404 | | |
392 | 405 | | |
393 | 406 | | |
| |||
469 | 482 | | |
470 | 483 | | |
471 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
472 | 489 | | |
473 | 490 | | |
474 | 491 | | |
| |||
489 | 506 | | |
490 | 507 | | |
491 | 508 | | |
492 | | - | |
| 509 | + | |
493 | 510 | | |
494 | 511 | | |
495 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
560 | | - | |
| 560 | + | |
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
| |||
1245 | 1245 | | |
1246 | 1246 | | |
1247 | 1247 | | |
1248 | | - | |
| 1248 | + | |
1249 | 1249 | | |
1250 | 1250 | | |
1251 | 1251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
66 | 101 | | |
67 | 102 | | |
68 | 103 | | |
| |||
0 commit comments