We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e8ad48 commit b4cf36dCopy full SHA for b4cf36d
1 file changed
lib/onelogin/ruby-saml/utils.rb
@@ -15,6 +15,7 @@ class Utils
15
16
DSIG = "http://www.w3.org/2000/09/xmldsig#"
17
XENC = "http://www.w3.org/2001/04/xmlenc#"
18
+ DURATION_FORMAT = %r(^(-?)P(?:(?:(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?)|(?:(\d+)W))$)
19
20
# Checks if the x509 cert provided is expired
21
#
@@ -38,7 +39,7 @@ def self.is_cert_expired(cert)
38
39
# @return [Integer] The new timestamp, after the duration is applied.
40
41
def self.parse_duration(duration, timestamp=Time.now)
- matches = duration.match(/^(-?)P(?:(?:(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?)|(?:(\d+)W))$/)
42
+ matches = duration.match(DURATION_FORMAT)
43
44
if matches.nil?
45
raise Exception.new("Invalid ISO 8601 duration")
0 commit comments