UNPKG

botframework-connector

Version:

Bot Connector is autorest generated connector client.

110 lines 3.95 kB
/** * @module botframework-connector */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { ConfidentialClientApplication } from '@azure/msal-node'; import { ServiceClientCredentials, WebResource } from '@azure/core-http'; import { AuthenticatorResult } from './authenticatorResult'; /** * General AppCredentials auth implementation and cache. * Subclasses can implement refreshToken to acquire the token. */ export declare abstract class AppCredentials implements ServiceClientCredentials { private static readonly cache; appId: string; private _oAuthEndpoint; private _oAuthScope; private _tenant; tokenCacheKey: string; protected clientApplication: ConfidentialClientApplication; private toJSON; /** * Initializes a new instance of the [AppCredentials](xref:botframework-connector.AppCredentials) class. * * @param appId The App ID. * @param channelAuthTenant Tenant ID of the Azure AD tenant where the bot is created. * - Required for SingleTenant app types. * - Optional for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided. * * More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types. * @param oAuthScope The scope for the token. */ constructor(appId: string, channelAuthTenant?: string, oAuthScope?: string); /** * Gets tenant to be used for channel authentication. * * @returns The channel auth token tenant for this credential. */ private get tenant(); /** * Sets tenant to be used for channel authentication. */ private set tenant(value); /** * Gets the OAuth scope to use. * * @returns The OAuth scope to use. */ get oAuthScope(): string; /** * Sets the OAuth scope to use. */ set oAuthScope(value: string); /** * Gets the OAuth endpoint to use. * * @returns The OAuthEndpoint to use. */ get oAuthEndpoint(): string; /** * Sets the OAuth endpoint to use. */ set oAuthEndpoint(value: string); /** * Adds the host of service url to trusted hosts. * If expiration time is not provided, the expiration date will be current (utc) date + 1 day. * * @deprecated * * @param {string} serviceUrl The service url * @param {Date} expiration? The expiration date after which this service url is not trusted anymore */ static trustServiceUrl(serviceUrl: string, expiration?: Date): void; /** * Checks if the service url is for a trusted host or not. * * @deprecated * * @param {string} serviceUrl The service url * @returns {boolean} True if the host of the service url is trusted; False otherwise. */ static isTrustedServiceUrl(serviceUrl: string): boolean; /** * Apply the credentials to the HTTP request. * * @param webResource The WebResource HTTP request. * @returns A Promise representing the asynchronous operation. */ signRequest(webResource: WebResource): Promise<WebResource>; /** * Gets an OAuth access token. * * @param forceRefresh True to force a refresh of the token; or false to get * a cached token if it exists. * @returns A Promise that represents the work queued to execute. * @remarks If the promise is successful, the result contains the access token string. */ getToken(forceRefresh?: boolean): Promise<string>; protected GetToChannelFromBotOAuthScope(): string; protected GetToChannelFromBotLoginUrlPrefix(): string; protected GetDefaultChannelAuthTenant(): string; protected abstract refreshToken(): Promise<AuthenticatorResult>; /** * @private */ private shouldSetToken; } //# sourceMappingURL=appCredentials.d.ts.map