botbuilder
Version:
Bot Builder is a framework for building rich bots on virtually any platform.
37 lines • 1.89 kB
TypeScript
import { Middleware, Storage, TurnContext } from 'botbuilder-core';
/**
* If the activity name is signin/tokenExchange, this middleware will attempt to
* exchange the token, and deduplicate the incoming call, ensuring only one
* exchange request is processed.
*
* If a user is signed into multiple Teams clients, the Bot could receive a
* "signin/tokenExchange" from each client. Each token exchange request for a
* specific user login will have an identical activity.value.id.
*
* Only one of these token exchange requests should be processed by the bot.
* The others return [StatusCodes.PRECONDITION_FAILED](xref:botframework-schema:StatusCodes.PRECONDITION_FAILED).
* For a distributed bot in production, this requires distributed storage
* ensuring only one token exchange is processed. This middleware supports
* CosmosDb storage found in botbuilder-azure, or MemoryStorage for local development.
*/
export declare class TeamsSSOTokenExchangeMiddleware implements Middleware {
private readonly storage;
private readonly oAuthConnectionName;
/**
* Initializes a new instance of the TeamsSSOTokenExchangeMiddleware class.
*
* @param storage The [Storage](xref:botbuilder-core.Storage) to use for deduplication
* @param oAuthConnectionName The connection name to use for the single sign on token exchange
*/
constructor(storage: Storage, oAuthConnectionName: string);
/**
* Called each time the bot receives a new request.
*
* @param context Context for current turn of conversation with the user.
* @param next Function to call to continue execution to the next step in the middleware chain.
*/
onTurn(context: TurnContext, next: () => Promise<void>): Promise<void>;
private deduplicatedTokenExchangeId;
private exchangedToken;
}
//# sourceMappingURL=teamsSSOTokenExchangeMiddleware.d.ts.map