UNPKG

botframework-connector

Version:

Bot Connector is autorest generated connector client.

65 lines 2.96 kB
"use strict"; /** * @module botframework-connector */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MicrosoftAppCredentials = void 0; const appCredentials_1 = require("./appCredentials"); const msalAppCredentials_1 = require("./msalAppCredentials"); /** * MicrosoftAppCredentials auth implementation */ class MicrosoftAppCredentials extends appCredentials_1.AppCredentials { /** * Initializes a new instance of the [MicrosoftAppCredentials](xref:botframework-connector.MicrosoftAppCredentials) class. * * @param {string} appId The Microsoft app ID. * @param {string} appPassword The Microsoft app password. * @param {string} 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 {string} oAuthScope Optional. The scope for the token. */ constructor(appId, appPassword, channelAuthTenant, oAuthScope) { super(appId, channelAuthTenant, oAuthScope); this.appPassword = appPassword; } /** * @inheritdoc */ getToken(forceRefresh = false) { var _a; return __awaiter(this, void 0, void 0, function* () { (_a = this.credentials) !== null && _a !== void 0 ? _a : (this.credentials = new msalAppCredentials_1.MsalAppCredentials(this.appId, this.appPassword, this.oAuthEndpoint, this.oAuthScope)); return this.credentials.getToken(forceRefresh); }); } /** * @inheritdoc */ refreshToken() { // This will never be executed because we are using MsalAppCredentials.getToken underneath. throw new Error('Method not implemented.'); } } exports.MicrosoftAppCredentials = MicrosoftAppCredentials; /** * An empty set of credentials. */ MicrosoftAppCredentials.Empty = new MicrosoftAppCredentials(null, null); //# sourceMappingURL=microsoftAppCredentials.js.map