Commit f82f3cc
Changed files (2)
lib
saml
kit
spec
saml
lib/saml/kit/metadata.rb
@@ -29,6 +29,18 @@ module Saml
document.find_all("/md:EntityDescriptor/md:#{name}/md:NameIDFormat").map(&:text)
end
+ def organization_name
+ document.find_by("/md:EntityDescriptor/md:Organization/md:OrganizationName").try(:text)
+ end
+
+ def organization_url
+ document.find_by("/md:EntityDescriptor/md:Organization/md:OrganizationURL").try(:text)
+ end
+
+ def contact_person_company
+ document.find_by("/md:EntityDescriptor/md:ContactPerson/md:Company").try(:text)
+ end
+
def certificates
@certificates ||= document.find_all("/md:EntityDescriptor/md:#{name}/md:KeyDescriptor").map do |item|
cert = item.at_xpath("./ds:KeyInfo/ds:X509Data/ds:X509Certificate", Xml::NAMESPACES).text
spec/saml/metadata_spec.rb
@@ -44,6 +44,9 @@ RSpec.describe Saml::Kit::Metadata do
expect(result.single_sign_on_services.count).to eql(2)
expect(result.assertion_consumer_services.count).to eql(1)
expect(result.single_logout_services.count).to eql(2)
+ expect(result.organization_name).to eql("Acme, Inc")
+ expect(result.organization_url).to eql("http://localhost:5000/")
+ expect(result.contact_person_company).to eql("mailto:hi@example.com")
end
end
end