EmulatorValidation Class

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

public final class EmulatorValidation

Validates and Examines JWT tokens from the Bot Framework Emulator.

Method Summary

Modifier and Type Method and Description
static java.util.concurrent.CompletableFuture<ClaimsIdentity> authenticateToken(String authHeader, CredentialProvider credentials, ChannelProvider channelProvider, String channelId)

Validate the incoming Auth Header as a token sent from the Bot Framework Emulator.

static java.util.concurrent.CompletableFuture<ClaimsIdentity> authenticateToken(String authHeader, CredentialProvider credentials, ChannelProvider channelProvider, String channelId, AuthenticationConfiguration authConfig)

Validate the incoming Auth Header as a token sent from the Bot Framework Emulator.

static TokenValidationParameters getTokenValidationParameters()

TO BOT FROM EMULATOR.

static java.lang.Boolean isTokenFromEmulator(String authHeader)

Determines if a given Auth header is from the Bot Framework Emulator.

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

Method Details

authenticateToken

public static CompletableFuture authenticateToken(String authHeader, CredentialProvider credentials, ChannelProvider channelProvider, String channelId)

Validate the incoming Auth Header as a token sent from the Bot Framework Emulator. A token issued by the Bot Framework will FAIL this check. Only Emulator tokens will pass.

Parameters:

authHeader - The raw HTTP header in the format: "Bearer [longString]".
credentials - The user defined set of valid credentials, such as the AppId.
channelProvider - The channelService value that distinguishes public Azure from US Government Azure.
channelId - The ID of the channel to validate.

Returns:

A valid ClaimsIdentity.

On join:

authenticateToken

public static CompletableFuture authenticateToken(String authHeader, CredentialProvider credentials, ChannelProvider channelProvider, String channelId, AuthenticationConfiguration authConfig)

Validate the incoming Auth Header as a token sent from the Bot Framework Emulator. A token issued by the Bot Framework will FAIL this check. Only Emulator tokens will pass.

Parameters:

authHeader - The raw HTTP header in the format: "Bearer [longString]".
credentials - The user defined set of valid credentials, such as the AppId.
channelProvider - The channelService value that distinguishes public Azure from US Government Azure.
channelId - The ID of the channel to validate.
authConfig - The authentication configuration.

Returns:

A valid ClaimsIdentity.

On join:

getTokenValidationParameters

public static TokenValidationParameters getTokenValidationParameters()

TO BOT FROM EMULATOR.

Returns:

Token validation parameters when connecting to a channel.

isTokenFromEmulator

public static Boolean isTokenFromEmulator(String authHeader)

Determines if a given Auth header is from the Bot Framework Emulator.

Parameters:

authHeader - Bearer Token, in the "Bearer [Long String]" Format.

Returns:

True, if the token was issued by the Emulator. Otherwise, false.

Applies to