次の方法で共有


JwtSecurityTokenHandler.WriteToken Method

Definition

Overloads

WriteToken(SecurityToken)

Serializes a JwtSecurityToken into a JWT in Compact Serialization Format.

WriteToken(XmlWriter, SecurityToken)

Serializes to XML a token of the type handled by this instance.

WriteToken(SecurityToken)

Serializes a JwtSecurityToken into a JWT in Compact Serialization Format.

public override string WriteToken (Microsoft.IdentityModel.Tokens.SecurityToken token);
override this.WriteToken : Microsoft.IdentityModel.Tokens.SecurityToken -> string
Public Overrides Function WriteToken (token As SecurityToken) As String

Parameters

token
SecurityToken

JwtSecurityToken to serialize.

Returns

A JWE or JWS in 'Compact Serialization Format'.

Exceptions

token is null.

'token' is not a not JwtSecurityToken.

Remarks

The JWT will be serialized as a JWE or JWS.

Payload will be used to create the JWT. If there is an inner token, the inner token's payload will be used.

If either SigningCredentials or InnerToken.SigningCredentials are set, the JWT will be signed.

If EncryptingCredentials is set, a JWE will be created using the JWT above as the plaintext.

Applies to

WriteToken(XmlWriter, SecurityToken)

Serializes to XML a token of the type handled by this instance.

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

Parameters

writer
XmlWriter

The XML writer.

token
SecurityToken

A token of type TokenType.

Applies to