File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ def parse(idp_metadata, options = {})
115115
116116 unless parsed_metadata [ :cache_duration ] . nil?
117117 cache_valid_until_timestamp = OneLogin ::RubySaml ::Utils . parse_duration ( parsed_metadata [ :cache_duration ] )
118- if parsed_metadata [ :valid_until ] . nil? || cache_valid_until_timestamp < Time . parse ( parsed_metadata [ :valid_until ] ) . to_i
118+ if parsed_metadata [ :valid_until ] . nil? || cache_valid_until_timestamp < Time . parse ( parsed_metadata [ :valid_until ] , Time . now . utc ) . to_i
119119 parsed_metadata [ :valid_until ] = Time . at ( cache_valid_until_timestamp ) . strftime ( "%Y-%m-%dT%H:%M:%SZ" )
120120 end
121121 end
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def self.is_cert_expired(cert)
3838 #
3939 # @return [Integer] The new timestamp, after the duration is applied.
4040 #
41- def self . parse_duration ( duration , timestamp = Time . now )
41+ def self . parse_duration ( duration , timestamp = Time . now . utc )
4242 matches = duration . match ( DURATION_FORMAT )
4343
4444 if matches . nil?
Original file line number Diff line number Diff line change @@ -336,24 +336,24 @@ def initialize; end
336336 end
337337
338338 it "if no ValidUntil but CacheDuration return CacheDuration converted in ValidUntil" do
339- Timecop . freeze ( Time . parse ( "2020-01-02T10:02:33Z" ) ) do
339+ Timecop . freeze ( Time . parse ( "2020-01-02T10:02:33Z" , Time . now . utc ) ) do
340340 settings = @idp_metadata_parser . parse ( idp_metadata_descriptor5 )
341341 assert_equal '2020-01-03T11:02:33Z' , settings . valid_until
342342 end
343343 end
344344
345345 it "if ValidUntil and CacheDuration return the sooner timestamp" do
346- Timecop . freeze ( Time . parse ( "2020-01-01T10:12:55Z" ) ) do
346+ Timecop . freeze ( Time . parse ( "2020-01-01T10:12:55Z" , Time . now . utc ) ) do
347347 settings = @idp_metadata_parser . parse ( idp_metadata_descriptor6 )
348348 assert_equal '2020-01-03T11:12:55Z' , settings . valid_until
349349 end
350350
351- Timecop . freeze ( Time . parse ( "2020-01-01T10:12:55Z" ) ) do
351+ Timecop . freeze ( Time . parse ( "2020-01-01T10:12:55Z" , Time . now . utc ) ) do
352352 settings = @idp_metadata_parser . parse ( idp_metadata_descriptor6 )
353353 assert_equal '2020-01-03T11:12:55Z' , settings . valid_until
354354 end
355355
356- Timecop . freeze ( Time . parse ( "2020-01-03T10:12:55Z" ) ) do
356+ Timecop . freeze ( Time . parse ( "2020-01-03T10:12:55Z" , Time . now . utc ) ) do
357357 settings = @idp_metadata_parser . parse ( idp_metadata_descriptor6 )
358358 assert_equal '2020-01-04T18:02:33.910Z' , settings . valid_until
359359 end
You can’t perform that action at this time.
0 commit comments