Skip to content

Commit b0a8834

Browse files
committed
Add docs
1 parent 25160fe commit b0a8834

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,3 +821,27 @@ end
821821
```
822822
823823
The `attribute_value` option additionally accepts an array of possible values.
824+
825+
## Custom Metadata Fields
826+
827+
Some IdPs may require to add SPs to add additional fields (Organization, ContactPerson, etc.)
828+
into the SP metadata. This can be acheived by extending the `OneLogin::RubySaml::Metadata`
829+
class and overriding the `#add_extras` method as per the following example:
830+
831+
```ruby
832+
class MyMetadata < OneLogin::RubySaml::Metadata
833+
def add_extras(root, _settings)
834+
org = root.add_element("md:Organization")
835+
org.add_element("md:OrganizationName", 'xml:lang' => "en-US").text = 'ACME Inc.'
836+
org.add_element("md:OrganizationDisplayName", 'xml:lang' => "en-US").text = 'ACME'
837+
org.add_element("md:OrganizationURL", 'xml:lang' => "en-US").text = 'https://www.acme.com'
838+
839+
cp = root.add_element("md:ContactPerson", 'contactType' => 'technical')
840+
cp.add_element("md:GivenName").text = 'ACME SAML Team'
841+
cp.add_element("md:EmailAddress").text = 'saml@acme.com'
842+
end
843+
end
844+
845+
# Output XML with custom metadata
846+
MyMetadata.new.generate(settings)
847+
```

0 commit comments

Comments
 (0)