Commit 8c3ed72
Changed files (2)
lib
saml
kit
spec
saml
lib/saml/kit/assertion.rb
@@ -36,7 +36,7 @@ module Saml
end
def active?(now = Time.current)
- now > configuration.clock_drift.before(started_at) && !expired?
+ now > configuration.clock_drift.seconds.before(started_at) && !expired?
end
def attributes
spec/saml/assertion_spec.rb
@@ -25,5 +25,25 @@ RSpec.describe Saml::Kit::Assertion do
expect(subject).to be_active
expect(subject).to_not be_expired
end
+
+ it 'interprets integers correctly' do
+ configuration.clock_drift = 30
+ now = Time.current
+ travel_to now
+ xml_hash = {
+ 'Response' => {
+ 'Assertion' => {
+ 'Conditions' => {
+ 'NotBefore' => now.utc.iso8601,
+ 'NotOnOrAfter' => configuration.session_timeout.since(now).iso8601,
+ }
+ }
+ }
+ }
+
+ subject = described_class.new(xml_hash, configuration: configuration)
+ expect(subject).to be_active
+ expect(subject).to_not be_expired
+ end
end
end