Commit 075bcdd
Changed files (2)
lib
saml
lib/saml/kit/assertion.rb
@@ -19,6 +19,14 @@ module Saml
xml_hash ? Signature.new(xml_hash) : nil
end
+ def expired?
+ Time.current > expired_at
+ end
+
+ def active?
+ Time.current > started_at && !expired?
+ end
+
def attributes
@attributes ||=
begin
@@ -40,15 +48,6 @@ module Saml
parse_date(assertion.fetch('Conditions', {}).fetch('NotOnOrAfter', nil))
end
- def certificate
- return unless signed?
-
- Saml::Kit::Certificate.new(
- assertion.fetch('Signature', {}).fetch('KeyInfo', {}).fetch('X509Data', {}).fetch('X509Certificate', nil),
- use: :signing
- )
- end
-
def audiences
Array(assertion['Conditions']['AudienceRestriction']['Audience'])
rescue => error
lib/saml/kit/response.rb
@@ -4,7 +4,7 @@ module Saml
include Respondable
extend Forwardable
- def_delegators :assertion, :name_id, :[], :attributes, :started_at, :expired_at, :audiences
+ def_delegators :assertion, :name_id, :[], :attributes, :active?, :audiences
validate :must_be_active_session
validate :must_match_issuer
@@ -14,14 +14,6 @@ module Saml
super(xml, name: "Response", configuration: configuration)
end
- def expired?
- Time.current > expired_at
- end
-
- def active?
- Time.current > started_at && !expired?
- end
-
def assertion
@assertion = Saml::Kit::Assertion.new(to_h, configuration: @configuration)
end