SamlSecurityTokenHandler.WriteAssertion Method (XmlWriter, SamlAssertion)

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Serializes the specified SAML assertion to the specified XML writer.

Namespace:   System.IdentityModel.Tokens
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

protected virtual void WriteAssertion(
	XmlWriter writer,
	SamlAssertion assertion
)

Parameters

writer
Type: System.Xml.XmlWriter

The XmlWriter to use for the serialization.

assertion
Type: System.IdentityModel.Tokens.SamlAssertion

A SamlAssertion that represents the assertion to serialize.

Exception Condition
ArgumentNullException

writer is null.

-or-

assertion is null.

InvalidOperationException

The assertion specified by assertion has both the T:System.IdentityModel.SecurityTokenService.EncryptingCredentials and T:System.IdentityModel.Tokens.SamlSecurityTokenHandler.ReceivedEncryptingCredentials properties set to null.

-or-

There are no statements and no subject in the assertion specified by data. (Both the P:System.IdentityModel.Tokens.SamlAssertion.Subject property and the Statements property are null.) If an assertion does not contain statements, it must contain a subject.

-or-

The assertion specified by assertion contains an authentication, attribute, or authorization decision statement and no subject—these statements require a subject. (The Statements property contains a statement of type SamlAttributeStatement, SamlAuthenticationStatement, or SamlAuthorizationDecisionStatement and the P:System.IdentityModel.Tokens.SamlAssertion.Subject property is null).

CryptographicException

The token encrypting credentials do not have a Symmetric Key specified.

.NET Framework
Available since 4.5
Return to top
Show: