Skip to content

Commit

Permalink
refactor: remove ApiPluginAAD feature flag and update related logic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
huimiu authored Jan 17, 2025
1 parent dc12c6b commit 8289a05
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
5 changes: 0 additions & 5 deletions packages/fx-core/src/common/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class FeatureFlagName {
static readonly DevTunnelTest = "TEAMSFX_DEV_TUNNEL_TEST";
static readonly SyncManifest = "TEAMSFX_SYNC_MANIFEST";
static readonly KiotaIntegration = "TEAMSFX_KIOTA_INTEGRATION";
static readonly ApiPluginAAD = "TEAMSFX_API_PLUGIN_AAD";
static readonly CEAEnabled = "TEAMSFX_CEA_ENABLED";
}

Expand Down Expand Up @@ -84,10 +83,6 @@ export class FeatureFlags {
name: FeatureFlagName.KiotaIntegration,
defaultValue: "false",
};
static readonly ApiPluginAAD = {
name: FeatureFlagName.ApiPluginAAD,
defaultValue: "false",
};
static readonly CEAEnabled = {
name: FeatureFlagName.CEAEnabled,
defaultValue: "false",
Expand Down
4 changes: 1 addition & 3 deletions packages/fx-core/src/question/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,7 @@ export function apiAuthQuestion(excludeNone = false): SingleSelectQuestion {
options.push(ApiAuthOptions.bearerToken(), ApiAuthOptions.microsoftEntra());
} else if (inputs[QuestionNames.ApiPluginType] === ApiPluginStartOptions.newApi().id) {
options.push(ApiAuthOptions.apiKey());
if (featureFlagManager.getBooleanValue(FeatureFlags.ApiPluginAAD)) {
options.push(ApiAuthOptions.microsoftEntra());
}
options.push(ApiAuthOptions.microsoftEntra());
options.push(ApiAuthOptions.oauth());
}
return options;
Expand Down
14 changes: 4 additions & 10 deletions packages/fx-core/tests/question/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,9 +1642,7 @@ describe("scaffold question", () => {
const tools = new MockTools();
setTools(tools);
beforeEach(() => {
mockedEnvRestore = mockedEnv({
[FeatureFlagName.ApiPluginAAD]: "true",
});
mockedEnvRestore = mockedEnv({});
});

afterEach(() => {
Expand Down Expand Up @@ -1981,7 +1979,6 @@ describe("scaffold question", () => {
it("traverse in cli", async () => {
mockedEnvRestore = mockedEnv({
TEAMSFX_CLI_DOTNET: "false",
[FeatureFlagName.ApiPluginAAD]: "true",
});

const inputs: Inputs = {
Expand Down Expand Up @@ -4064,9 +4061,7 @@ describe("scaffold question", () => {
const tools = new MockTools();
setTools(tools);
beforeEach(() => {
mockedEnvRestore = mockedEnv({
[FeatureFlagName.ApiPluginAAD]: "true",
});
mockedEnvRestore = mockedEnv({});
});

afterEach(() => {
Expand Down Expand Up @@ -4131,9 +4126,7 @@ describe("scaffold question", () => {
const tools = new MockTools();
setTools(tools);
beforeEach(() => {
mockedEnvRestore = mockedEnv({
[FeatureFlagName.ApiPluginAAD]: "false",
});
mockedEnvRestore = mockedEnv({});
});

afterEach(() => {
Expand All @@ -4154,6 +4147,7 @@ describe("scaffold question", () => {
assert.deepEqual(options, [
ApiAuthOptions.none(),
ApiAuthOptions.apiKey(),
ApiAuthOptions.microsoftEntra(),
ApiAuthOptions.oauth(),
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
import { Capability } from "../../utils/constants";
import { ProgrammingLanguage } from "@microsoft/teamsfx-core";
import { CaseFactory } from "../caseFactory";
import { FeatureFlagName } from "../../../../fx-core/src/common/featureFlags";

class DeclarativeAgentWithEntra extends CaseFactory {
public override async onBefore(): Promise<void> {
process.env[FeatureFlagName.ApiPluginAAD] = "true";
}
}
class DeclarativeAgentWithEntra extends CaseFactory {}

const myRecord: Record<string, string> = {};
myRecord["with-plugin"] = "yes";
Expand Down

0 comments on commit 8289a05

Please sign in to comment.