Redigera

Dela via


SessionSecurityTokenHandler.WriteToken Method

Definition

Serializes a token.

Overloads

WriteToken(SessionSecurityToken)

Serializes the specified token into a byte array.

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)

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

sessionToken
SessionSecurityToken

The token to write.

Returns

Byte[]

An encoded byte array.

Exceptions

sessiontoken is null.

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

Applies to

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

The XML writer with which to serialize the token.

token
SecurityToken

The token to serialize. An instance of SessionSecurityToken.

Exceptions

writer is null.

-or-

token is null.

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