Commit 49a26f4
Changed files (3)
lib
saml
spec
saml
lib/saml/kit/assertion.rb
@@ -28,7 +28,7 @@ module Saml
node, configuration: Saml::Kit.configuration, private_keys: []
)
@name = 'Assertion'
- @to_nokogiri = node
+ @to_nokogiri = node.is_a?(String) ? Nokogiri::XML(node).root : node
@configuration = configuration
@occurred_at = Time.current
@cannot_decrypt = false
lib/saml/kit/version.rb
@@ -2,6 +2,6 @@
module Saml
module Kit
- VERSION = '1.0.23'.freeze
+ VERSION = '1.0.24'.freeze
end
end
spec/saml/kit/assertion_spec.rb
@@ -240,4 +240,20 @@ RSpec.describe Saml::Kit::Assertion do
expect(response.assertion).to be_valid
end
end
+
+ describe ".new" do
+ let(:user) { instance_double(User, name_id_for: SecureRandom.uuid, assertion_attributes_for: {}) }
+ let(:saml_request) { double(id: SecureRandom.uuid, issuer: configuration.entity_id) }
+ let(:configuration) do
+ Saml::Kit::Configuration.new do |x|
+ x.entity_id = FFaker::Internet.uri('https')
+ end
+ end
+
+ it 'parses a raw xml assertion' do
+ saml = Saml::Kit::Response.build(user, saml_request, configuration: configuration)
+ subject = described_class.new(saml.assertion.to_xml, configuration: configuration)
+ expect(subject).to be_valid
+ end
+ end
end