1 | import { Middleware, Storage, TurnContext } from 'botbuilder-core';
|
2 | /**
|
3 | * If the activity name is signin/tokenExchange, this middleware will attempt to
|
4 | * exchange the token, and deduplicate the incoming call, ensuring only one
|
5 | * exchange request is processed.
|
6 | *
|
7 | * If a user is signed into multiple Teams clients, the Bot could receive a
|
8 | * "signin/tokenExchange" from each client. Each token exchange request for a
|
9 | * specific user login will have an identical activity.value.id.
|
10 | *
|
11 | * Only one of these token exchange requests should be processed by the bot.
|
12 | * The others return [StatusCodes.PRECONDITION_FAILED](xref:botframework-schema:StatusCodes.PRECONDITION_FAILED).
|
13 | * For a distributed bot in production, this requires distributed storage
|
14 | * ensuring only one token exchange is processed. This middleware supports
|
15 | * CosmosDb storage found in botbuilder-azure, or MemoryStorage for local development.
|
16 | */
|
17 | export declare class TeamsSSOTokenExchangeMiddleware implements Middleware {
|
18 | private readonly storage;
|
19 | private readonly oAuthConnectionName;
|
20 | /**
|
21 | * Initializes a new instance of the TeamsSSOTokenExchangeMiddleware class.
|
22 | *
|
23 | * @param storage The [Storage](xref:botbuilder-core.Storage) to use for deduplication
|
24 | * @param oAuthConnectionName The connection name to use for the single sign on token exchange
|
25 | */
|
26 | constructor(storage: Storage, oAuthConnectionName: string);
|
27 | /**
|
28 | * Called each time the bot receives a new request.
|
29 | *
|
30 | * @param context Context for current turn of conversation with the user.
|
31 | * @param next Function to call to continue execution to the next step in the middleware chain.
|
32 | */
|
33 | onTurn(context: TurnContext, next: () => Promise<void>): Promise<void>;
|
34 | private deduplicatedTokenExchangeId;
|
35 | private exchangedToken;
|
36 | }
|
37 | //# sourceMappingURL=teamsSSOTokenExchangeMiddleware.d.ts.map |
\ | No newline at end of file |