Specifies basic contact information about a person responsible in some capacity for a SAML entity or role. The use of this element is always optional. Its content is informative in nature and does not directly map to any core SAML elements or attributes.

Syntax

public class ContactPerson : ContactType

Examples

Shows how to create Metadata (EntityDescriptor) for an IdP.

using ComponentPro.Saml2.Metadata;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;

...

// Create a new instance of the EntityDescriptor class.
EntityDescriptor entityDescriptor = new EntityDescriptor();
// Set ID.
entityDescriptor.Id = "MPCSHKBKAJTWEF5RsrHcS2.R3Fb";
// Create a new instance of the AttributeAuthorityDescriptor class.
AttributeAuthorityDescriptor attributeAuthorityDescriptor = new AttributeAuthorityDescriptor();
// Add that AttributeAuthorityDescriptor to the entity descriptor.
entityDescriptor.AttributeAuthorityDescriptors.Add(attributeAuthorityDescriptor);

// Set binding type and location.
AttributeService attributeService = new AttributeService();
attributeService.Binding = "urn:oasis:names:tc:SAML:2.0:bindings:SOAP";
attributeService.Location = "https://xxx.xxxx.xxxx.com/idp/attrsvc.ssaml2";
attributeAuthorityDescriptor.AttributeServices.Add(attributeService);

// Load the key to sign
X509Certificate2 x509Certificate = new X509Certificate2(@"Pkey.pfx", "password");

IdpSsoDescriptor ssoDescriptor = new IdpSsoDescriptor();

SingleLogoutService slo = new SingleLogoutService();
slo.Location = "https://xxx.xxxx.xxxx.com/idp/SLO.saml2";
ssoDescriptor.SingleLogoutServices.Add(slo);

SingleSignOnService sso = new SingleSignOnService();
sso.Location = "https://xxx.xxxx.xxxx.com/idp/SSO.saml2";
ssoDescriptor.SingleSignOnServices.Add(sso);    

entityDescriptor.IdpSsoDescriptors.Add(ssoDescriptor);            

ContactPerson person = new ContactPerson();
person.Company = "company";
person.EmailAddresses.Add("a@email.com");
person.GivenName = "Jenna";

entityDescriptor.ContactPeople.Add(person);

// You can add more contact person here... 
 
#region Signing key descriptor if needed

// Load certificate to sign
KeyInfoX509Data certKeyInfoX509Data = new KeyInfoX509Data(x509Certificate);
KeyInfo certKeyInfo = new KeyInfo();
certKeyInfo.AddClause(certKeyInfoX509Data);

// Add key descriptor
KeyDescriptor keyDesc = new KeyDescriptor();
keyDesc.Use = "signing";
keyDesc.KeyInfo = certKeyInfo.GetXml();           

ssoDescriptor.KeyDescriptors.Add(keyDesc);

#endregion 
 
//ssoDescriptor.Sign(x509Certificate);        
entityDescriptor.Sign(x509Certificate); // Sign the entity descriptor if needed 
 
string xml = entityDescriptor.GetXml().OuterXml;

System.Diagnostics.Trace.WriteLine(xml);

Inheritance Hierarchy

         ComponentPro.Saml2.Metadata.ComponentPro.Saml2.Metadata.ContactPerson

Framework

.NET Framework.NET Framework

Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
Assembly: ComponentPro.Saml (in ComponentPro.Saml.dll)

See Also