@microsoft/teams-ai
Version:
SDK focused on building AI based applications for Microsoft Teams.
48 lines • 2.38 kB
TypeScript
import { TokenResponse, TurnContext } from 'botbuilder';
/**
* @internal
* Base class to handle authentication for Teams Message Extension.
*/
export declare abstract class MessageExtensionAuthenticationBase {
private readonly title;
private readonly text;
constructor(title?: string, text?: string);
/**
* Authenticates the user.
* @param {TurnContext} context - The turn context.
* @returns {Promise<string | undefined>} - The authentication token, or undefined if authentication failed. Teams will ask user to sign-in if authentication failed.
*/
authenticate(context: TurnContext): Promise<string | undefined>;
/**
* Checks if the activity is a valid Message Extension activity that supports authentication.
* @param {TurnContext} context - The turn context.
* @returns {boolean} - A boolean indicating if the activity is valid.
*/
isValidActivity(context: TurnContext): boolean;
/**
* Handles the SSO token exchange.
* @param {TurnContext} context - The turn context.
* @returns {Promise<TokenResponse | undefined>} - A promise that resolves to the token response or undefined if token exchange failed.
*/
abstract handleSsoTokenExchange(context: TurnContext): Promise<TokenResponse | undefined>;
/**
* Handles the user sign-in.
* @param {TurnContext} context - The turn context.
* @param {string} magicCode - The magic code from user sign-in.
* @returns {Promise<TokenResponse | undefined>} - A promise that resolves to the token response or undefined if failed to verify the magic code.
*/
abstract handleUserSignIn(context: TurnContext, magicCode: string): Promise<TokenResponse | undefined>;
/**
* Gets the sign-in link for the user.
* @param {TurnContext} context - The turn context.
* @returns {Promise<string | undefined>} - A promise that resolves to the sign-in link or undefined if no sign-in link available.
*/
abstract getSignInLink(context: TurnContext): Promise<string | undefined>;
/**
* Should sign in using SSO flow.
* @param {TurnContext} context - The turn context.
* @returns {boolean} - A boolean indicating if the sign-in should use SSO flow.
*/
abstract isSsoSignIn(context: TurnContext): boolean;
}
//# sourceMappingURL=MessageExtensionAuthenticationBase.d.ts.map