SessionSecurityTokenHandler.WriteToken SessionSecurityTokenHandler.WriteToken SessionSecurityTokenHandler.WriteToken SessionSecurityTokenHandler.WriteToken Method

Definition

Serializes a token.

Overloads

WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken)

Serializes the specified token into a byte array.

WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken)

Serializes the specified token by using the specified XML writer.

Remarks

The default implementation serializes the token into either a WS-Secure Conversation Feb2005 or WS-Secure Conversation 1.3 <wsc:SecurityContextToken> element.

WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken) WriteToken(SessionSecurityToken)

Serializes the specified token into a byte array.

public:
 virtual cli::array <System::Byte> ^ WriteToken(System::IdentityModel::Tokens::SessionSecurityToken ^ sessionToken);
public virtual byte[] WriteToken (System.IdentityModel.Tokens.SessionSecurityToken sessionToken);
override this.WriteToken : System.IdentityModel.Tokens.SessionSecurityToken -> byte[]
Public Overridable Function WriteToken (sessionToken As SessionSecurityToken) As Byte()

Parameters

Returns

Byte[]

An encoded byte array.

Exceptions

Remarks

Serializes the specified token by creating and XML writer over a MemoryStream and invoking the SessionSecurityTokenHandler.WriteToken(XmlWriter, SecurityToken) method. See that overload for more details.

See also

WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken) WriteToken(XmlWriter, SecurityToken)

Serializes the specified token by using the specified XML writer.

public:
 override void WriteToken(System::Xml::XmlWriter ^ writer, System::IdentityModel::Tokens::SecurityToken ^ token);
public override void WriteToken (System.Xml.XmlWriter writer, System.IdentityModel.Tokens.SecurityToken token);
override this.WriteToken : System.Xml.XmlWriter * System.IdentityModel.Tokens.SecurityToken -> unit
Public Overrides Sub WriteToken (writer As XmlWriter, token As SecurityToken)

Parameters

writer
XmlWriter XmlWriter XmlWriter XmlWriter

The XML writer with which to serialize the token.

token
SecurityToken SecurityToken SecurityToken SecurityToken

The token to serialize. An instance of SessionSecurityToken.

Exceptions

token is not assignable from SessionSecurityToken.

-or-

The SecureConversationVersion of the token specifies a version of WS-Secure Conversation that is not supported by the handler.

Remarks

The default implementation serializes the specified token as either a WS-Secure Conversation Feb2005 or WS-Secure Conversation 1.3 <wsc:SecurityContextToken> element, depending on the value of the SessionSecurityToken.SecureConversationVersion property. The SessionSecurityToken.Id property is serialized as the Id attribute. The SessionSecurityToken.ContextId property is serialized as the <Identifier> child element. If not null the SessionSecurityToken.KeyGeneration property is serialized as an <Instance> element. Finally, if the SessionSecurityToken.IsReferenceMode property is false, the entire token is serialized into binary array which is passed to the ApplyTransforms method to be encoded. The encoded token is then written as a base64 encoded value to the element and namespace specified by the CookieElementName and CookieNamespace properties. If the SessionSecurityToken.IsReferenceMode property is true, the token is not serialized.

See also

Applies to