A URI reference that identifies an intended audience. The URI reference MAY identify a document that describes the terms and conditions of audience membership. It MAY also contain the unique identifier URI from a SAML name identifier.

      Syntax

      public class Audience : SamlObject

      Examples

      Shows how to create a Response object and sign it.

      using System;
      using ComponentPro.Saml2;
      using System.Xml;
      using System.Security.Cryptography.X509Certificates;
      
      ...
      
      X509Certificate2 x509Certificate = new X509Certificate2(@"..\..\Pkey.pfx", "password");
      
      // Create SAML Response object.
      Response response = new Response();
      
      Assertion samlAssertion = new Assertion();
      Audience aud = new Audience();
      aud.Uri = "http://testuri.org";
      AudienceRestriction ar = new AudienceRestriction();
      ar.Audiences.Add(aud);
      
      samlAssertion.Conditions = new Conditions();
      samlAssertion.Conditions.ConditionsList.Add(ar);
      
      samlAssertion.Sign(x509Certificate);
      
      // Add SAML Assertion
      response.Assertions.Add(samlAssertion);
      
      // You can also sign the SAML response with the following code
      response.Sign(x509Certificate);
      
      XmlElement xmlElement = response.GetXml();
      
      System.Diagnostics.Trace.WriteLine(xmlElement.OuterXml);
      Console.WriteLine(xmlElement.OuterXml);

      Inheritance Hierarchy

            ComponentPro.Saml2.ComponentPro.Saml2.Audience

      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