EncryptedSecurityTokenHandler.ReadToken Method (XmlReader)

.NET Framework (current version)
 

Reads an encrypted security token.

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

public override SecurityToken ReadToken(
	XmlReader reader
)

Parameters

reader
Type: System.Xml.XmlReader

The reader from which to read the token.

Return Value

Type: System.IdentityModel.Tokens.SecurityToken

A security token of type EncryptedSecurityToken.

Exception Condition
ArgumentNullException

reader is null.

InvalidOperationException

There is no configured service token resolver. (Either the SecurityTokenHandler.Configuration property or the SecurityTokenHandlerConfiguration.ServiceTokenResolver property of the referenced token handler configuration is null. A service token resolver is required to obtain keys for decryption.

-or-

The SecurityTokenHandlerCollectionReferenced through the ContainingCollection property is unable to find a SecurityTokenHandler that can read the decrypted XML and return a SecurityToken.

SecurityTokenException

A SecurityKeyIdentifier is not found inside the XML pointed to by the reader.

-or-

The SecurityKeyIdentifier is not a SymmetricSecurityKey.

EncryptedTokenDecryptionFailedException

The SecurityKeyIdentifier found inside the XML cannot be resolved by the configured service token resolver to a SecurityKey.

.NET Framework
Available since 4.5
Return to top
Show: