SamlSerializer Class


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

Serializes and deserializes SamlSecurityToken objects into and from XML documents.

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


public class SamlSerializer


Initializes a new instance of the SamlSerializer class.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodLoadAdvice(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads the additional information provided by the SAML authority within a <saml:Advice> element of a SAML assertion using the specified XML reader.

System_CAPS_pubmethodLoadAssertion(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads a SAML assertion from the specified XML reader.

System_CAPS_pubmethodLoadAttribute(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads an attribute of the subject of a SAML security token using the specified XML reader.

System_CAPS_pubmethodLoadCondition(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads a condition that must be taken into account when assessing the validity of a SAML assertion using the specified XML reader.

System_CAPS_pubmethodLoadConditions(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads a set of conditions that must be taken into account when assessing the validity of a SAML assertion using the specified XML reader.

System_CAPS_pubmethodLoadStatement(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads a SAML statement using the specified XML reader.


Creates a shallow copy of the current Object.(Inherited from Object.)


Replaces the default set of XML elements and attributes that are recognized by this serializer with the specified dictionary of elements and attributes.

System_CAPS_pubmethodReadToken(XmlReader, SecurityTokenSerializer, SecurityTokenResolver)

Reads a SAML security token from the specified XML reader.


Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodWriteToken(SamlSecurityToken, XmlWriter, SecurityTokenSerializer)

Writes the specified SAML security token into the specified XML serializer.

XML serialization is the process of converting an object's public properties and fields to a serial format (in this case, XML) for storage or transport. Deserialization re-creates the object in its original state from the XML.

The SamlSerializer class serializes and deserializes SAML security tokens, which have an extensible format. Unlike many other security tokens, SamlSecurityToken security tokens include XML elements and attributes that can be customized for an application's needs. Some of the extensibility points for a SAML assertion include the <saml:Advice>, <saml:Condition>, and <saml:Statement> elements. For more details about overriding how each of these elements are read, see the LoadAdvice(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver), LoadCondition(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver), and LoadStatement(XmlDictionaryReader, SecurityTokenSerializer, SecurityTokenResolver) methods.

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top