Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Identity] Removed AzureApplicationCredential from our public API #18129

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sdk/identity/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ async function main() {

#### New credentials

Identity v2 includes three new credential types:
Identity v2 includes two new credential types:

- `AzurePowerShellCredential`, which re-uses any account previously authenticated with the `Az.Account` PowerShell module.
- `AzureApplicationCredential`, which is a simplified `DefaultAzureCredential` that only includes `EnvironmentCredential` and `ManagedIdentityCredential`.
- `OnBehalfOfCredential`, which enables the [On-Behalf-Of authentication flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).

#### New features in all credentials
Expand Down Expand Up @@ -107,7 +106,7 @@ Azure Service Fabric support hasn't been added on the initial version 2 of Ident

#### Breaking Changes from 2.0.0-beta.6

- Renamed the `ApplicationCredential` to `AzureApplicationCredential`.
- Stopped exporting the `ApplicationCredential` from the package. This will be re-introduced in the future.
- Removed the `CredentialPersistenceOptions` from `DefaultAzureCredential` and `EnvironmentCredential`.
- Merged the configuration and the options bag on the `OnBehalfOfCredential` into a single options bag.
- `AuthenticationRequiredError` (introduced in 2.0.0-beta.1) now has its parameters into a single options bag.
Expand Down
10 changes: 0 additions & 10 deletions sdk/identity/identity/review/identity.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ export class AuthorizationCodeCredential implements TokenCredential {
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
}

// @public
export class AzureApplicationCredential extends ChainedTokenCredential {
constructor(options?: AzureApplicationCredentialOptions);
}

// @public
export interface AzureApplicationCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
managedIdentityClientId?: string;
}

// @public
export enum AzureAuthorityHosts {
AzureChina = "https://login.chinacloudapi.cn",
Expand Down
4 changes: 0 additions & 4 deletions sdk/identity/identity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export { UsernamePasswordCredentialOptions } from "./credentials/usernamePasswor
export { AuthorizationCodeCredential } from "./credentials/authorizationCodeCredential";
export { AzurePowerShellCredential } from "./credentials/azurePowerShellCredential";
export { AzurePowerShellCredentialOptions } from "./credentials/azurePowerShellCredentialOptions";
export {
AzureApplicationCredential,
AzureApplicationCredentialOptions
} from "./credentials/azureApplicationCredential";

export {
VisualStudioCodeCredential,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { assert } from "chai";
import { RestError } from "@azure/core-rest-pipeline";
import { AzureApplicationCredential } from "../../../src";
import { AzureApplicationCredential } from "../../../src/credentials/azureApplicationCredential";
import { prepareIdentityTests } from "../../httpRequests";
import {
createResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
// Licensed under the MIT license.

import { assert } from "chai";
import { AzureApplicationCredential } from "../../../src";
import { MsalTestCleanup, msalNodeTestSetup, testTracing } from "../../msalTestUtils";
import { getError } from "../../authTestUtils";
import { Context } from "mocha";
import { AccessToken, GetTokenOptions, TokenCredential } from "@azure/core-auth";

describe("AzureApplicationCredential", function() {
// TODO: Use the real one once we decide to re-enable this on the public API.
class AzureApplicationCredential implements TokenCredential {
getToken(_scope: string | string[], _getTokenOptions?: GetTokenOptions): Promise<AccessToken> {
throw new Error("Not implemented");
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just here to prevent us from removing this file. It’s easier to clean up by the time we decide to include the AzureApplicationCredential back on the public API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this test file to the internal folder instead? That way, we get to keep the test coverage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s already a test file for this credential in the internal folder. These ones use recordings, which we could move to fit the internal folder path etc, but feels unnecessary since this isn’t part of the public API. The decision to either remove this credential or add it back will happen right after (or around) the GA date.


// TODO: Re-enable this when possible.
describe.skip("AzureApplicationCredential", function() {
let cleanup: MsalTestCleanup;
const environmentVariableNames = ["AZURE_TENANT_ID", "AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET"];
const cachedValues: Record<string, string | undefined> = {};
Expand Down