Skip to content

Commit ba37e1f

Browse files
Update add_extras in readme
1 parent a7dba95 commit ba37e1f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -929,22 +929,24 @@ or underscore, and can only contain letters, digits, underscores, hyphens, and p
929929

930930
Some IdPs may require to add SPs to add additional fields (Organization, ContactPerson, etc.)
931931
into the SP metadata. This can be done by extending the `RubySaml::Metadata` class and
932-
overriding the `#add_extras` method using a Nokogiri XML builder as per the following example:
932+
overriding the `#add_extras` method where the first arg is a
933+
[Nokogiri::XML::Builder](https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html) object as per
934+
the following example:
933935

934936
```ruby
935937
class MyMetadata < RubySaml::Metadata
936938
private
937939

938940
def add_extras(xml, _settings)
939-
xml['md'].Organization do
940-
xml['md'].OrganizationName('ACME Inc.', 'xml:lang' => 'en-US')
941-
xml['md'].OrganizationDisplayName('ACME', 'xml:lang' => 'en-US')
942-
xml['md'].OrganizationURL('https://www.acme.com', 'xml:lang' => 'en-US')
941+
xml.Organization do
942+
xml.OrganizationName('xml:lang' => 'en-US') { xml.text 'ACME Inc.' }
943+
xml.OrganizationDisplayName('xml:lang' => 'en-US') { xml.text 'ACME' }
944+
xml.OrganizationURL('xml:lang' => 'en-US') { xml.text 'https://www.acme.com' }
943945
end
944946

945-
xml['md'].ContactPerson('contactType' => 'technical') do
946-
xml['md'].GivenName('ACME SAML Team')
947-
xml['md'].EmailAddress('saml@acme.com')
947+
xml.ContactPerson('contactType' => 'technical') do
948+
xml.GivenName { xml.text 'ACME SAML Team' }
949+
xml.EmailAddress { xml.text 'saml@acme.com' }
948950
end
949951
end
950952
end

0 commit comments

Comments
 (0)