JwtSecurityTokenHandler.ReadToken Method (XmlReader)

Reads a JSON web token wrapped inside a WS-Security BinarySecurityToken xml element.

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

Syntax

'Declaration
Public Overridable Function ReadToken ( _
    reader As XmlReader _
) As SecurityToken
public virtual SecurityToken ReadToken(
    XmlReader reader
)
public:
virtual SecurityToken^ ReadToken(
    XmlReader^ reader
)
abstract ReadToken : 
        reader:XmlReader -> SecurityToken  
override ReadToken : 
        reader:XmlReader -> SecurityToken
public function ReadToken(
    reader : XmlReader
) : SecurityToken

Parameters

Return Value

Type: System.IdentityModel.Tokens.SecurityToken
An instance of JwtSecurityToken

Exceptions

Exception Condition
ArgumentNullException

'reader' is null.

ArgumentException

if CanReadToken returns false.

Remarks

First calls JwtSecurityToken.CanReadTokenThe reader must be positioned at an element named:

BinarySecurityToken'. in the namespace: 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' with a 'ValueType' attribute equal to one of: "urn:ietf:params:oauth:token-type:jwt", "JWT".

For example <wsse:BinarySecurityToken valueType = "JWT">

The 'EncodingType' attribute is optional, if it is set, it must be equal to: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"

.NET Framework Security

See Also

Reference

JwtSecurityTokenHandler Class

ReadToken Overload

System.IdentityModel.Tokens Namespace