EndorsementsValidator Class

  • java.lang.Object
    • com.microsoft.bot.connector.authentication.EndorsementsValidator

public abstract class EndorsementsValidator

Verify that the specified endorsement exists on the JWT token.

Constructor Summary

Constructor Description
EndorsementsValidator()

Method Summary

Modifier and Type Method and Description
static boolean validate(String expectedEndorsement, List<String> endorsements)

Verify that the specified endorsement exists on the JWT token.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

EndorsementsValidator

public EndorsementsValidator()

Method Details

validate

public static boolean validate(String expectedEndorsement, List endorsements)

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 com.microsoft.bot.schema.Activity#getChannelId() property is set to "webchat" and the signing party of the JWT token must have a corresponding endorsement of \u201cWebchat\u201d.

Parameters:

expectedEndorsement - The expected endorsement. Generally the ID of the channel to validate, typically extracted from the activity's com.microsoft.bot.schema.Activity#getChannelId() property, that to which the Activity is affinitized. Alternatively, it could represent a compliance certification that is required.
endorsements - The JWT token\u2019s 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\u2019s Schema.Activity.ChannelId MUST be found in the endorsement list, or the incoming activity is not considered valid.

Returns:

True is the expected endorsement is found in the Endorsement set.

Throws:

java.lang.IllegalArgumentException - Missing endorsements

Applies to