Share via


Saml2SecurityTokenHandler.ValidateSignature Method

Definition

Validates that the signature.

protected virtual Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityToken ValidateSignature (string token, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters);
abstract member ValidateSignature : string * Microsoft.IdentityModel.Tokens.TokenValidationParameters -> Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityToken
override this.ValidateSignature : string * Microsoft.IdentityModel.Tokens.TokenValidationParameters -> Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityToken
Protected Overridable Function ValidateSignature (token As String, validationParameters As TokenValidationParameters) As Saml2SecurityToken

Parameters

token
String

A Saml2 token.

validationParameters
TokenValidationParameters

The TokenValidationParameters to be used for validating the token.

Returns

A Saml2SecurityToken that has had the signature validated if token was signed.

Exceptions

If validationParameters is null.

If a signature is not found and RequireSignedTokens is true.

If the token has a key identifier and none of the SecurityKey(s) provided result in a validated signature. This can indicate that a key refresh is required.

If after trying all the SecurityKey(s), none result in a validated signature AND the 'token' does not have a key identifier.

Remarks

If the 'token' is signed, the signature is validated even if RequireSignedTokens is false.

If the 'token' signature is validated, then the SigningKey will be set to the key that signed the 'token'. It is the responsibility of SignatureValidator to set the SigningKey

Applies to