Metadata xml for IDP

Hello, Iam following the Metadata Export example to genearate a metadata file for our IDP. How can we modify the code so that the metadata file also contains information about attributes that are present in the SAML Token. We need to pass this to a client who is going to use our IDP

Thanks

The ExportMetadata example generates an EntityDescriptor.


EntityDescriptor entityDescriptor = MetadataExporter.Export(samlConfiguration, x509Certificate, partnerName);
SaveMetadata(entityDescriptor);

The EntityDescriptor contains an IDPSSODescriptor. The IDPSSODescriptor.Attributes property may be used to add SAML attributes to the metadata.

For example:


EntityDescriptor entityDescriptor = MetadataExporter.Export(samlConfiguration, x509Certificate, partnerName);
entityDescriptor.IDPSSODescriptors[0].Attributes.Add(new SAMLAttribute(“Email”, null, null));
entityDescriptor.IDPSSODescriptors[0].Attributes.Add(new SAMLAttribute(“FirstName”, null, null));
entityDescriptor.IDPSSODescriptors[0].Attributes.Add(new SAMLAttribute(“Surname”, null, null));
SaveMetadata(entityDescriptor);

Please refer to the SAMLAttribute documentation for the various SAMLAttribute constructors.