Validators.ValidateAudience Method

Definition

Determines if the audiences found in a SecurityToken are valid.

public static void ValidateAudience (System.Collections.Generic.IEnumerable<string> audiences, Microsoft.IdentityModel.Tokens.SecurityToken securityToken, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters);
static member ValidateAudience : seq<string> * Microsoft.IdentityModel.Tokens.SecurityToken * Microsoft.IdentityModel.Tokens.TokenValidationParameters -> unit
Public Shared Sub ValidateAudience (audiences As IEnumerable(Of String), securityToken As SecurityToken, validationParameters As TokenValidationParameters)

Parameters

audiences
IEnumerable<String>

The audiences found in the SecurityToken.

securityToken
SecurityToken

The SecurityToken being validated.

validationParameters
TokenValidationParameters

TokenValidationParameters required for validation.

Exceptions

If 'audiences' is null and ValidateAudience is true.

If none of the 'audiences' matched either ValidAudience or one of ValidAudiences.

Remarks

An EXACT match is required.

Applies to