/** * @module botframework-connector */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import * as msrest from '@azure/ms-rest-js'; import * as adal from 'adal-node'; /** * General AppCredentials auth implementation and cache. Supports any ADAL client credential flow. * Subclasses can implement refreshToken to acquire the token. */ export declare abstract class AppCredentials implements msrest.ServiceClientCredentials { private static readonly cache; appId: string; private _oAuthEndpoint?; private _oAuthScope?; private _tenant?; tokenCacheKey: string; protected refreshingToken: Promise | null; protected authenticationContext: adal.AuthenticationContext | null; private toJSON; /** * Initializes a new instance of the [AppCredentials](xref:botframework-connector.AppCredentials) class. * * @param appId The App ID. * @param channelAuthTenant Optional. The oauth token tenant. * @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: msrest.WebResource): Promise; /** * 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; protected abstract refreshToken(): Promise; /** * @private */ private shouldSetToken; } //# sourceMappingURL=appCredentials.d.ts.map