Commit ab0b88e
Simon Coffey
Support decimal seconds in cacheDuration parsing
Since the introduction of cacheDuration parsing in 25cbddd we've been
seeing parsing failures for one of our IdPs, whose cacheDuration value
is set to
cacheDuration="PT6H0M0.000S"
This is a valid ISO8601 duration, however the regexp being used for
parsing doesn't provide for the possibility of milliseconds.
The ISO8601 spec[1] supports decimal values for at least some of a
duration's components (S4.4.3.2):
> If necessary for a particular application, the lowest order
> components may have a decimal fraction.
It's not entirely plain which components this might refer to, however
the xsd:duration spec[2] is plainer:
> The numbers may be any unsigned integer, with the exception of the
> number of seconds, which may be an unsigned decimal number.
This commit therefore adds fractional seconds support to the duration
parsing. To ensure that we actually respect these values, I've updated
our parsed value coercion to produce floats for all components. This is
arguably unnecessary for the non-float components (since the regexp will
only accept integers), but it allows us to reduce the code with no ill
effects.
The ISO spec permits arbitrary decimal precision, and supports both
commas and dots as the decimal separator, so since the xsd:duration
schema doesn't mention either concern, I've followed the ISO spec here.
[1] https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf
[2] http://www.datypic.com/sc/xsd/t-xsd_duration.html1 parent f3aa90a commit ab0b88e
2 files changed
+14
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 62 | + | |
| 63 | + | |
69 | 64 | | |
70 | 65 | | |
71 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
0 commit comments