• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-js / 12431934596

20 Dec 2024 01:03PM UTC coverage: 84.624% (-0.001%) from 84.625%
12431934596

Pull #4822

github

web-flow
Merge 6ca2ae0d0 into 3b8fcab21
Pull Request #4822: fix: [#4684] ESLint issues in botframework-connector

8185 of 10821 branches covered (75.64%)

Branch coverage included in aggregate %.

12 of 16 new or added lines in 14 files covered. (75.0%)

1 existing line in 1 file now uncovered.

20512 of 23090 relevant lines covered (88.83%)

7400.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.67
/libraries/botframework-connector/src/auth/federatedServiceClientCredentialsFactory.ts
1
/**
2
 * @module botframework-connector
3
 */
4
// Copyright (c) Microsoft Corporation.
5
// Licensed under the MIT License.
6

7
import { ok } from 'assert';
2✔
8
import type { ServiceClientCredentials } from '@azure/core-http';
9
import { ServiceClientCredentialsFactory } from './serviceClientCredentialsFactory';
2✔
10
import { FederatedAppCredentials } from './federatedAppCredentials';
2✔
11

12
/**
13
 * A Federated Credentials implementation of the [ServiceClientCredentialsFactory](xref:botframework-connector.ServiceClientCredentialsFactory) interface.
14
 */
15
export class FederatedServiceClientCredentialsFactory extends ServiceClientCredentialsFactory {
2✔
16
    /**
17
     * Initializes a new instance of the [FederatedServiceClientCredentialsFactory](xref:botframework-connector.FederatedServiceClientCredentialsFactory) class.
18
     *
19
     * @param {string} appId App ID for the Application.
20
     * @param {string} clientId Client ID for the managed identity assigned to the bot.
21
     * @param {string} tenantId Tenant ID of the Azure AD tenant where the bot is created.
22
     *   - **Required** for SingleTenant app types.
23
     *   - **Optional** for MultiTenant app types. **Note**: '_botframework.com_' is the default tenant when no value is provided.
24
     *
25
     * More information: https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types.
26
     * @param {string} clientAudience **Optional**. The Audience used in the Client's Federated Credential. **Default** (_api://AzureADTokenExchange_).
27
     */
28
    constructor(
29
        private appId: string,
×
30
        private clientId: string,
×
31
        private tenantId?: string,
×
NEW
32
        private clientAudience?: string,
×
33
    ) {
34
        super();
×
35

36
        ok(appId?.trim(), 'FederatedServiceClientCredentialsFactory.constructor(): missing appId.');
×
37
        ok(clientId?.trim(), 'FederatedServiceClientCredentialsFactory.constructor(): missing clientId.');
×
38
    }
39

40
    /**
41
     * @inheritdoc
42
     */
43
    async isValidAppId(appId = ''): Promise<boolean> {
×
44
        return appId === this.appId;
×
45
    }
46

47
    /**
48
     * @inheritdoc
49
     */
50
    async isAuthenticationDisabled(): Promise<boolean> {
51
        // Auth is always enabled for FIC.
52
        return;
×
53
    }
54

55
    /**
56
     * @inheritdoc
57
     */
58
    async createCredentials(appId: string, audience: string): Promise<ServiceClientCredentials> {
59
        ok(
×
60
            await this.isValidAppId(appId),
61
            'FederatedServiceClientCredentialsFactory.createCredentials(): Invalid App ID.',
62
        );
63

64
        return new FederatedAppCredentials(this.appId, this.clientId, this.tenantId, audience, this.clientAudience);
×
65
    }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc