Saml2SecurityTokenHandler.ValidateToken Method

Definition

Overloads

ValidateToken(String, TokenValidationParameters, SecurityToken)

Reads and validates a Saml2SecurityToken.

ValidateToken(XmlReader, TokenValidationParameters, SecurityToken)

Reads and validates a Saml2SecurityToken.

ValidateToken(String, TokenValidationParameters, SecurityToken)

Reads and validates a Saml2SecurityToken.

public override System.Security.Claims.ClaimsPrincipal ValidateToken (string token, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters, out Microsoft.IdentityModel.Tokens.SecurityToken validatedToken);
override this.ValidateToken : string * Microsoft.IdentityModel.Tokens.TokenValidationParameters * SecurityToken -> System.Security.Claims.ClaimsPrincipal
Public Overrides Function ValidateToken (token As String, validationParameters As TokenValidationParameters, ByRef validatedToken As SecurityToken) As ClaimsPrincipal

Parameters

token
String

The Saml2 token.

validationParameters
TokenValidationParameters

The TokenValidationParameters to be used for validating the token.

validatedToken
SecurityToken

The Saml2SecurityToken that was validated.

Returns

A ClaimsPrincipal representing the identity contained in the token.

Exceptions

validationParameters is null.

token.Length is greater than MaximumTokenSizeInBytes.

if the token is not well-formed.

Applies to

ValidateToken(XmlReader, TokenValidationParameters, SecurityToken)

Reads and validates a Saml2SecurityToken.

public override System.Security.Claims.ClaimsPrincipal ValidateToken (System.Xml.XmlReader reader, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters, out Microsoft.IdentityModel.Tokens.SecurityToken validatedToken);
override this.ValidateToken : System.Xml.XmlReader * Microsoft.IdentityModel.Tokens.TokenValidationParameters * SecurityToken -> System.Security.Claims.ClaimsPrincipal
Public Overrides Function ValidateToken (reader As XmlReader, validationParameters As TokenValidationParameters, ByRef validatedToken As SecurityToken) As ClaimsPrincipal

Parameters

reader
XmlReader

A XmlReader reader positioned at a saml2 assertion element.

validationParameters
TokenValidationParameters

The TokenValidationParameters to be used for validating the token.

validatedToken
SecurityToken

The Saml2SecurityToken that was validated.

Returns

A ClaimsPrincipal representing the identity contained in the token.

Exceptions

if validationParameters is null.

if the token is not well-formed.

Applies to