botbuilder-core
Version:
Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.
132 lines • 8.12 kB
TypeScript
import * as z from 'zod';
import { Activity } from 'botframework-schema';
import { Configuration } from 'botbuilder-dialogs-adaptive-runtime-core';
import { AuthenticateRequestResult, AuthenticationConfiguration, BotFrameworkAuthentication, BotFrameworkClient, ClaimsIdentity, ConnectorClientOptions, ConnectorFactory, ServiceClientCredentialsFactory, UserTokenClient } from 'botframework-connector';
declare const TypedOptions: z.ZodObject<{
MicrosoftAppId: z.ZodOptional<z.ZodString>;
MicrosoftAppTenantId: z.ZodOptional<z.ZodString>;
OAuthApiEndpoint: z.ZodOptional<z.ZodString>;
BotOpenIdMetadata: z.ZodOptional<z.ZodNullable<z.ZodString>>;
ChannelService: z.ZodOptional<z.ZodString>;
ValidateAuthority: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
ToChannelFromBotLoginUrl: z.ZodOptional<z.ZodString>;
ToChannelFromBotOAuthScope: z.ZodOptional<z.ZodString>;
ToBotFromChannelTokenIssuer: z.ZodOptional<z.ZodString>;
OAuthUrl: z.ZodOptional<z.ZodString>;
ToBotFromChannelOpenIdMetadataUrl: z.ZodOptional<z.ZodString>;
ToBotFromEmulatorOpenIdMetadataUrl: z.ZodOptional<z.ZodString>;
CallerId: z.ZodOptional<z.ZodString>;
CertificateThumbprint: z.ZodOptional<z.ZodString>;
CertificatePrivateKey: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
BotOpenIdMetadata?: string;
ChannelService?: string;
OAuthApiEndpoint?: string;
CertificateThumbprint?: string;
CertificatePrivateKey?: string;
MicrosoftAppId?: string;
MicrosoftAppTenantId?: string;
ValidateAuthority?: string | boolean;
ToChannelFromBotLoginUrl?: string;
ToChannelFromBotOAuthScope?: string;
ToBotFromChannelTokenIssuer?: string;
OAuthUrl?: string;
ToBotFromChannelOpenIdMetadataUrl?: string;
ToBotFromEmulatorOpenIdMetadataUrl?: string;
CallerId?: string;
}, {
BotOpenIdMetadata?: string;
ChannelService?: string;
OAuthApiEndpoint?: string;
CertificateThumbprint?: string;
CertificatePrivateKey?: string;
MicrosoftAppId?: string;
MicrosoftAppTenantId?: string;
ValidateAuthority?: string | boolean;
ToChannelFromBotLoginUrl?: string;
ToChannelFromBotOAuthScope?: string;
ToBotFromChannelTokenIssuer?: string;
OAuthUrl?: string;
ToBotFromChannelOpenIdMetadataUrl?: string;
ToBotFromEmulatorOpenIdMetadataUrl?: string;
CallerId?: string;
}>;
/**
* Contains settings used to configure a [ConfigurationBotFrameworkAuthentication](xref:botbuilder-core.ConfigurationBotFrameworkAuthentication) instance.
*/
export declare type ConfigurationBotFrameworkAuthenticationOptions = z.infer<typeof TypedOptions>;
/**
* Creates a [BotFrameworkAuthentication](xref:botframework-connector.BotFrameworkAuthentication) instance from an object with the authentication values or a [Configuration](xref:botbuilder-dialogs-adaptive-runtime-core.Configuration) instance.
*/
export declare class ConfigurationBotFrameworkAuthentication extends BotFrameworkAuthentication {
private readonly inner;
/**
* Initializes a new instance of the [ConfigurationBotFrameworkAuthentication](xref:botbuilder-core.ConfigurationBotFrameworkAuthentication) class.
*
* @param botFrameworkAuthConfig A [ConfigurationBotFrameworkAuthenticationOptions](xref:botbuilder-core.ConfigurationBotFrameworkAuthenticationOptions) object.
* @param credentialsFactory A [ServiceClientCredentialsFactory](xref:botframework-connector.ServiceClientCredentialsFactory) instance.
* @param authConfiguration A [Configuration](xref:botframework-connector.AuthenticationConfiguration) object.
* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
*/
constructor(botFrameworkAuthConfig?: ConfigurationBotFrameworkAuthenticationOptions, credentialsFactory?: ServiceClientCredentialsFactory, authConfiguration?: AuthenticationConfiguration, botFrameworkClientFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, connectorClientOptions?: ConnectorClientOptions);
/**
* Authenticate Bot Framework Protocol requests to Skills.
*
* @param authHeader The http auth header received in the skill request.
* @returns {Promise<ClaimsIdentity>} A [ClaimsIdentity](xref:botframework-connector.ClaimsIdentity).
*/
authenticateChannelRequest(authHeader: string): Promise<ClaimsIdentity>;
/**
* Validate Bot Framework Protocol requests.
*
* @param activity The inbound Activity.
* @param authHeader The HTTP auth header.
* @returns {Promise<AuthenticateRequestResult>} An [AuthenticateRequestResult](xref:botframework-connector.AuthenticateRequestResult).
*/
authenticateRequest(activity: Activity, authHeader: string): Promise<AuthenticateRequestResult>;
/**
* Validate Bot Framework Protocol requests.
*
* @param authHeader The HTTP auth header.
* @param channelIdHeader The channel ID HTTP header.
* @returns {Promise<AuthenticateRequestResult>} An [AuthenticateRequestResult](xref:botframework-connector.AuthenticateRequestResult).
*/
authenticateStreamingRequest(authHeader: string, channelIdHeader: string): Promise<AuthenticateRequestResult>;
/**
* Creates a BotFrameworkClient for calling Skills.
*
* @returns A [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
*/
createBotFrameworkClient(): BotFrameworkClient;
/**
* Creates a ConnectorFactory that can be used to create ConnectorClients that can use credentials from this particular Cloud Environment.
*
* @param claimsIdentity The inbound Activity's ClaimsIdentity.
* @returns A [ConnectorFactory](xref:botframework-connector.ConnectorFactory).
*/
createConnectorFactory(claimsIdentity: ClaimsIdentity): ConnectorFactory;
/**
* Creates the appropriate UserTokenClient instance.
*
* @param claimsIdentity The inbound Activity's ClaimsIdentity.
* @returns {Promise<UserTokenClient>} An [UserTokenClient](xref:botframework-connector.UserTokenClient).
*/
createUserTokenClient(claimsIdentity: ClaimsIdentity): Promise<UserTokenClient>;
}
/**
* Creates a new instance of the [ConfigurationBotFrameworkAuthentication](xref:botbuilder-core.ConfigurationBotFrameworkAuthentication) class.
*
* @remarks
* The [Configuration](xref:botbuilder-dialogs-adaptive-runtime-core.Configuration) instance provided to the constructor should
* have the desired authentication values available at the root, using the properties of [ConfigurationBotFrameworkAuthenticationOptions](xref:botbuilder-core.ConfigurationBotFrameworkAuthenticationOptions) as its keys.
* @param configuration A [Configuration](xref:botbuilder-dialogs-adaptive-runtime-core.Configuration) instance.
* @param credentialsFactory A [ServiceClientCredentialsFactory](xref:botframework-connector.ServiceClientCredentialsFactory) instance.
* @param authConfiguration A [Configuration](xref:botframework-connector.AuthenticationConfiguration) object.
* @param botFrameworkClientFetch A custom Fetch implementation to be used in the [BotFrameworkClient](xref:botframework-connector.BotFrameworkClient).
* @param connectorClientOptions A [ConnectorClientOptions](xref:botframework-connector.ConnectorClientOptions) object.
* @returns A [ConfigurationBotFrameworkAuthentication](xref:botbuilder-core.ConfigurationBotFrameworkAuthentication) instance.
*/
export declare function createBotFrameworkAuthenticationFromConfiguration(configuration: Configuration, credentialsFactory?: ServiceClientCredentialsFactory, authConfiguration?: AuthenticationConfiguration, botFrameworkClientFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, connectorClientOptions?: ConnectorClientOptions): BotFrameworkAuthentication;
export {};
//# sourceMappingURL=configurationBotFrameworkAuthentication.d.ts.map