Skip to content

Commit

Permalink
[Identity] Removed AzureApplicationCredential from our public API (#1…
Browse files Browse the repository at this point in the history
…8129)

* [Identity] Removed AzureApplicationCredential from our public API

* Apply suggestions from code review

Co-authored-by: Ramya Rao <[email protected]>

Co-authored-by: Ramya Rao <[email protected]>
  • Loading branch information
sadasant and ramya-rao-a authored Oct 12, 2021
1 parent 1e706fc commit 68fbad6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
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 @@ -109,7 +108,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");
}
}

// 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

0 comments on commit 68fbad6

Please sign in to comment.