Jaa


EndorsementsValidator.Validate(String, HashSet<String>) Method

Definition

Verify that the specified endorsement exists on the JWT token. Call this method multiple times to validate multiple endorsements. For example, if an Activity comes from WebChat, that activity's ChannelId property is set to "webchat" and the signing party of the JWT token must have a corresponding endorsement of “Webchat”.

public static bool Validate (string expectedEndorsement, System.Collections.Generic.HashSet<string> endorsements);
static member Validate : string * System.Collections.Generic.HashSet<string> -> bool
Public Shared Function Validate (expectedEndorsement As String, endorsements As HashSet(Of String)) As Boolean

Parameters

expectedEndorsement
String

The expected endorsement. Generally the ID of the channel to validate, typically extracted from the activity's ChannelId property, that to which the Activity is affinitized. Alternatively, it could represent a compliance certification that is required.

endorsements
HashSet<String>

The JWT token’s signing party is permitted to send activities only for specific channels. That list, the set of channels the service can sign for, is called the endorsement list. The activity’s ChannelId MUST be found in the endorsement list, or the incoming activity is not considered valid.

Returns

True if the channel ID is found in the endorsements list; otherwise, false.

Remarks

JWT token signing keys contain endorsements matching the IDs of the channels they are approved to sign for. They also contain keywords representing compliance certifications. This code ensures that a channel ID or compliance certification is present on the signing key used for the request's token.

Applies to