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.
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);
Imports ComponentPro.Saml2
Imports System.Xml
Imports System.Security.Cryptography.X509Certificates
...
Dim x509Certificate As New X509Certificate2("..\..\Pkey.pfx", "password")
' Create SAML Response object.
Dim response As New Response()
Dim samlAssertion As New Assertion()
Dim aud As New Audience()
aud.Uri = "http://testuri.org"
Dim ar As 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)
Dim xmlElement As XmlElement = response.GetXml()
System.Diagnostics.Trace.WriteLine(xmlElement.OuterXml)
Console.WriteLine(xmlElement.OuterXml)
ComponentPro.Saml2.ComponentPro.Saml2.Audience