How to use the botframework-connector.AuthenticationConstants.ChannelService function in botframework-connector

To help you get started, we’ve selected a few botframework-connector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / libraries / botbuilder / src / botFrameworkAdapter.ts View on Github external
// If settings.certificateThumbprint & settings.certificatePrivateKey are provided,
        // use CertificateAppCredentials.
        if (this.settings.certificateThumbprint && this.settings.certificatePrivateKey) {
            this.credentials = new CertificateAppCredentials(this.settings.appId, settings.certificateThumbprint, settings.certificatePrivateKey, this.settings.channelAuthTenant);
            this.credentialsProvider = new SimpleCredentialProvider(this.credentials.appId, '');
        } else {
            this.credentials = new MicrosoftAppCredentials(this.settings.appId, this.settings.appPassword || '', this.settings.channelAuthTenant);
            this.credentialsProvider = new SimpleCredentialProvider(this.credentials.appId, this.settings.appPassword || '');
        }
        
        this.isEmulatingOAuthCards = false;

        // If no channelService or openIdMetadata values were passed in the settings, check the process' Environment Variables for values.
        // These values may be set when a bot is provisioned on Azure and if so are required for the bot to properly work in Public Azure or a National Cloud.
        this.settings.channelService = this.settings.channelService || process.env[AuthenticationConstants.ChannelService];
        this.settings.openIdMetadata = this.settings.openIdMetadata || process.env[AuthenticationConstants.BotOpenIdMetadataKey];

        this.authConfiguration = this.settings.authConfig || new AuthenticationConfiguration();

        if (this.settings.openIdMetadata) {
            ChannelValidation.OpenIdMetadataEndpoint = this.settings.openIdMetadata;
            GovernmentChannelValidation.OpenIdMetadataEndpoint = this.settings.openIdMetadata;
        }
        if (JwtTokenValidation.isGovernment(this.settings.channelService)) {
            this.credentials.oAuthEndpoint = GovernmentConstants.ToChannelFromBotLoginUrl;
            this.credentials.oAuthScope = GovernmentConstants.ToChannelFromBotOAuthScope;
        }

        // If a NodeWebSocketFactoryBase was passed in, set it on the BotFrameworkAdapter.
        if (this.settings.webSocketFactory) {
            this.webSocketFactory = this.settings.webSocketFactory;
github microsoft / botbuilder-js / libraries / botbuilder / src / botFrameworkHttpClient.ts View on Github external
constructor(private readonly credentialProvider: ICredentialProvider, private readonly channelService?: string) {
        if (!this.credentialProvider) {
            throw new Error('BotFrameworkHttpClient(): missing credentialProvider');
        }
        if (!this.channelService) {
            this.channelService = process.env[AuthenticationConstants.ChannelService];
        }
    }
github microsoft / botbuilder-js / libraries / botbuilder / src / channelServiceHandler.ts View on Github external
constructor(
        private readonly credentialProvider: ICredentialProvider,
        private readonly authConfig: AuthenticationConfiguration,
        private readonly channelService?: string) {
        if (!this.channelService) {
            this.channelService = process.env[AuthenticationConstants.ChannelService];
        }
        if (!this.credentialProvider) {
            throw new Error('BotFrameworkHttpClient(): missing credentialProvider');
        }
        if (!this.authConfig) {
            throw new Error('BotFrameworkHttpClient(): missing authConfig');
        }
    }