Commit 32925b4

mo <mo.khan@gmail.com>
2017-11-10 22:56:54
remove friendly_name and NameFormat.
1 parent 8d49e8b
lib/saml/kit/identity_provider_metadata.rb
@@ -32,8 +32,7 @@ module Saml
       def attributes
         find_all("/md:EntityDescriptor/md:#{name}/saml:Attribute").map do |item|
           {
-            format: item.attribute("NameFormat").value,
-            friendly_name: item.attribute("FriendlyName").value,
+            format: item.attribute("NameFormat").try(:value),
             name: item.attribute("Name").value,
           }
         end
@@ -93,7 +92,7 @@ module Saml
                   xml.SingleSignOnService Binding: item[:binding], Location: item[:location]
                 end
                 attributes.each do |attribute|
-                  xml.tag! 'saml:Attribute', NameFormat: Namespaces::URI, Name: attribute, FriendlyName: attribute
+                  xml.tag! 'saml:Attribute', Name: attribute
                 end
               end
               xml.Organization do
spec/saml/identity_provider_metadata_spec.rb
@@ -38,8 +38,6 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
       expect(result['EntityDescriptor']['IDPSSODescriptor']['SingleLogoutService']['Binding']).to eql('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST')
       expect(result['EntityDescriptor']['IDPSSODescriptor']['SingleLogoutService']['Location']).to eql("https://www.example.com/logout")
       expect(result['EntityDescriptor']['IDPSSODescriptor']['Attribute']['Name']).to eql("id")
-      expect(result['EntityDescriptor']['IDPSSODescriptor']['Attribute']['FriendlyName']).to eql("id")
-      expect(result['EntityDescriptor']['IDPSSODescriptor']['Attribute']['NameFormat']).to eql("urn:oasis:names:tc:SAML:2.0:attrname-format:uri")
       expect(result['EntityDescriptor']['IDPSSODescriptor']['KeyDescriptor']['KeyInfo']['X509Data']['X509Certificate']).to eql(Saml::Kit.configuration.stripped_signing_certificate)
 
       expect(result['EntityDescriptor']['Organization']['OrganizationName']).to eql(org_name)
@@ -131,7 +129,6 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
     it do
       expect(subject.attributes).to include({
         format: "urn:oasis:names:tc:SAML:2.0:attrname-format:uri",
-        friendly_name: "E-Mail Address",
         name: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
       })
     end