37 lines
No EOL
1.9 KiB
TypeScript
37 lines
No EOL
1.9 KiB
TypeScript
import { Middleware, Storage, TurnContext } from 'botbuilder-core';
|
|
/**
|
|
* If the activity name is cardExtension/token, 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 devices, the Bot could receive a
|
|
* "cardExtension/token" from each device. 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 SharePointSSOTokenExchangeMiddleware implements Middleware {
|
|
private readonly storage;
|
|
private readonly oAuthConnectionName;
|
|
/**
|
|
* Initializes a new instance of the SharePointSSOTokenExchangeMiddleware 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=sharePointSSOTokenExchangeMiddleware.d.ts.map
|