Expand Minimize

Saml2SecurityTokenHandler.DetectReplayedToken Method

.NET Framework 4.6 and 4.5

Throws an exception if the specified token already exists in the token replay cache; otherwise the token is added to the cache.

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

protected override void DetectReplayedToken(
	SecurityToken token


Type: System.IdentityModel.Tokens.SecurityToken

A SecurityToken that represents the SAML 2.0 security token (the token should be of type Saml2SecurityToken) to be checked.


token is null.


The Configuration property is null.


There is no TokenReplayCache configured under the Caches property of the handler configuration (accessed through the Configuration property).


token cannot be cast as an instance of Saml2SecurityToken.


The ID of the assertion associated with the token is null or empty. (The Assertion property of the token references a Saml2Assertion that has an Id property that references a Saml2Id with a Value property that is null or empty.)


The token already exists in the TokenReplayCache.

The default behavior is to only check bearer tokens (tokens that do not have keys). The token replay cache is the TokenReplayCache object configured for this handler through the Caches property of the SecurityTokenHandlerConfiguration object referenced through the Configuration property.

.NET Framework

Supported in: 4.6, 4.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft