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] Migrated to core-rest-pipeline #16514

Merged
merged 37 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9b5a838
wip
sadasant Jul 14, 2021
4330fba
wip
sadasant Jul 15, 2021
35540c3
wip
sadasant Jul 19, 2021
883154b
wip
sadasant Jul 20, 2021
2e71456
now builds, but I havent executed things
sadasant Jul 20, 2021
0fac985
wip
sadasant Jul 21, 2021
3f50154
wip
sadasant Jul 21, 2021
f8361c5
Merge remote-tracking branch 'Azure/main' into feature/identity-15595
sadasant Jul 21, 2021
2299de3
wip
sadasant Jul 22, 2021
102f671
got some tests to work again
sadasant Jul 22, 2021
73ba09f
browser tests are beginning to pass
sadasant Jul 22, 2021
8388eac
now, a whole test file is passing on node and browser
sadasant Jul 22, 2021
7c93687
all of the node tests are passing
sadasant Jul 22, 2021
3c229f5
some comments
sadasant Jul 22, 2021
2a5cb79
no more "assert"
sadasant Jul 22, 2021
5830c2c
addressed #16436
sadasant Jul 22, 2021
2d28c4b
Merge remote-tracking branch 'Azure/main' into feature/identity-15595
sadasant Jul 22, 2021
b367eeb
final details
sadasant Jul 22, 2021
9719d61
Merge remote-tracking branch 'Azure/main' into feature/identity-15595
sadasant Jul 22, 2021
a7cd072
re-using things from core-utils
sadasant Jul 22, 2021
ef9f1fa
this fixes a problem I'm having on keyvault-secrets
sadasant Jul 23, 2021
c28c000
fixing tests on Node 16
sadasant Jul 23, 2021
9805c5e
ServiceClientOptions to CommonClientOptions
sadasant Jul 23, 2021
2cc1de1
Update sdk/identity/identity/src/credentials/managedIdentityCredentia…
sadasant Jul 28, 2021
11b8133
some of the feedback by Will
sadasant Jul 28, 2021
31e6181
after cleaning up my environment and reinstalling, this proxyPolicy c…
sadasant Jul 28, 2021
99c78be
undid the getKnownAuthorities change after clarifying
sadasant Jul 28, 2021
bb1033a
switching to the shared rollup config on Identity
sadasant Jul 28, 2021
bdaa212
rollup fix
sadasant Jul 28, 2021
cfc10e0
@azure/identity on the external arrays intead of the other two packages
sadasant Jul 28, 2021
0ecb070
Identity package.json cleanup
sadasant Jul 28, 2021
37e33ef
addressed https://github.com/Azure/azure-sdk-for-js/pull/16514#discus…
sadasant Aug 4, 2021
f16496f
JSON.parse type
sadasant Aug 4, 2021
1c6919e
adfs comment
sadasant Aug 4, 2021
35042a9
no need to config dotenv, the recorder does this
sadasant Aug 4, 2021
7ddf2e9
Merge remote-tracking branch 'Azure/main' into feature/identity-15595
sadasant Aug 4, 2021
b6a5399
test fix after https://github.com/Azure/azure-sdk-for-js/commit/0bceb…
sadasant Aug 6, 2021
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
9 changes: 7 additions & 2 deletions sdk/identity/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- With this release, we've migrated from using `@azure/core-http` to `@azure/core-rest-pipeline` for the handling of HTTP requests. See [Azure Core v1 vs v2](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/documentation/core2.md) for more on the difference and benefits of the move. This removes our dependency on `node-fetch` and along with it issues we have seen in using this dependency in specific environments like Kubernetes pods.

### Other Changes

## 2.0.0-beta.4 (2021-07-07)
Expand Down Expand Up @@ -37,7 +39,7 @@
### Key Bugs Fixed

- Fixed an issue in which `InteractiveBrowserCredential` on Node would sometimes cause the process to hang if there was no browser available.
- Fixed an issue in which the `AZURE_AUTHORITY_HOST` environment variable was not properly picked up in NodeJS.
- Fixed an issue in which the `AZURE_AUTHORITY_HOST` environment variable was not properly picked up in Node.js.

## 2.0.0-beta.3 (2021-05-12)

Expand Down Expand Up @@ -68,6 +70,9 @@

> With the plans for [third party cookies to be removed from browsers](https://docs.microsoft.com/azure/active-directory/develop/reference-third-party-cookies-spas), the **implicit grant flow is no longer a suitable authentication method**. The [silent SSO features](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow#getting-access-tokens-silently-in-the-background) of the implicit flow do not work without third party cookies, causing applications to break when they attempt to get a new token. We strongly recommend that all new applications use the authorization code flow that now supports single page apps in place of the implicit flow, and that [existing single page apps begin migrating to the authorization code flow](https://docs.microsoft.com/azure/active-directory/develop/migrate-spa-implicit-to-auth-code) as well.

## 1.5.0 (2021-07-19)

- With this release, we've migrated from using `@azure/core-http` to `@azure/core-rest-pipeline` for the handling of HTTP requests. See [Azure Core v1 vs v2](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/documentation/core2.md) for more on the difference and benefits of the move. This removes our dependency on `node-fetch` and along with it issues we have seen in using this dependency in specific environments like Kubernetes pods.

## 1.4.0 (2021-07-09)

Expand Down Expand Up @@ -135,7 +140,7 @@ This release doesn't have the changes from `1.2.4-beta.1`.

## 1.2.3 (2021-02-09)

- Fixed Azure Stack support for the NodeJS version of the `InteractiveBrowserCredential`. Fixes issue [11220](https://github.com/Azure/azure-sdk-for-js/issues/11220).
- Fixed Azure Stack support for the Node.js version of the `InteractiveBrowserCredential`. Fixes issue [11220](https://github.com/Azure/azure-sdk-for-js/issues/11220).
- The 'keytar' dependency has been updated to the latest version.
- No longer overrides global Axios defaults. This includes an update in `@azure/identity`'s source, and an update of the `@azure/msal-node` dependency. Fixes issue [13343](https://github.com/Azure/azure-sdk-for-js/issues/13343).

Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The `DefaultAzureCredential` is appropriate for most scenarios where the applica

> Note: `DefaultAzureCredential` is intended to simplify getting started with the SDK by handling common scenarios with reasonable default behaviors. Developers who want more control or whose scenario isn't served by the default settings should use other credential types.

If used from NodeJS, the `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order:
If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order:

![DefaultAzureCredential authentication flow][defaultauthflow_image]

Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/interactive-browser-credential.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Interactive Browser Credential

The `InteractiveBrowserCredential` uses [Authorization Code Flow][AuthCodeFlow], which uses [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636) both on the browser and on NodeJS. Under the hood it uses [@azure/msal-node](https://www.npmjs.com/package/@azure/msal-node) for Node.js and [@azure/msal-browser](https://www.npmjs.com/package/@azure/msal-browser) in browsers.
The `InteractiveBrowserCredential` uses [Authorization Code Flow][AuthCodeFlow], which uses [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636) both on the browser and on Node.js. Under the hood it uses [@azure/msal-node](https://www.npmjs.com/package/@azure/msal-node) for Node.js and [@azure/msal-browser](https://www.npmjs.com/package/@azure/msal-browser) in browsers.

`InteractiveBrowserCredential` can be used both in Node and in browsers. For each case, there are some important considerations that must be taken.

Expand Down
25 changes: 18 additions & 7 deletions sdk/identity/identity/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config({ path: "../.env" });
require("dotenv").config();
const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode
} = require("@azure/test-utils-recorder");

module.exports = function(config) {
config.set({
Expand Down Expand Up @@ -29,7 +35,7 @@ module.exports = function(config) {
files: [
"dist-test/index.browser.js",
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
],
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),

// list of files / patterns to exclude
exclude: [],
Expand All @@ -47,7 +53,7 @@ module.exports = function(config) {
// inject following environment values into browser testing with window.__env__
// environment values MUST be exported or set with same console running "karma start"
// https://www.npmjs.com/package/karma-env-preprocessor
envPreprocessor: ["ACCOUNT_NAME", "ACCOUNT_SAS", "TEST_MODE"],
envPreprocessor: ["AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET", "AZURE_TENANT_ID", "TEST_MODE"],

// test results reporter to use
// possible values: 'dots', 'progress'
Expand Down Expand Up @@ -88,10 +94,15 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE'
browsers: ["ChromeHeadless"],
// --no-sandbox allows our tests to run in Linux without having to change the system.
// --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex.
browsers: ["ChromeHeadlessNoSandbox"],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox", "--disable-web-security"]
}
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
23 changes: 19 additions & 4 deletions sdk/identity/identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"module": "dist-esm/src/index.js",
"types": "./types/identity.d.ts",
"browser": {
"os": false,
"process": false,
"./dist-esm/src/credentials/azureCliCredential.js": "./dist-esm/src/credentials/azureCliCredential.browser.js",
"./dist-esm/src/credentials/environmentCredential.js": "./dist-esm/src/credentials/environmentCredential.browser.js",
"./dist-esm/src/credentials/managedIdentityCredential/index.js": "./dist-esm/src/credentials/managedIdentityCredential/index.browser.js",
Expand All @@ -21,12 +23,13 @@
"./dist-esm/src/credentials/azurePowerShellCredential.js": "./dist-esm/src/credentials/azurePowerShellCredential.browser.js",
"./dist-esm/src/util/authHostEnv.js": "./dist-esm/src/util/authHostEnv.browser.js",
"./dist-esm/src/tokenCache/TokenCachePersistence.js": "./dist-esm/src/tokenCache/TokenCachePersistence.browser.js",
"./dist-esm/src/extensions/consumer.js": "./dist-esm/src/extensions/consumer.browser.js"
"./dist-esm/src/extensions/consumer.js": "./dist-esm/src/extensions/consumer.browser.js",
"./dist-esm/test/httpRequests.js": "./dist-esm/test/httpRequests.browser.js"
},
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:samples": "echo skipped",
"build:test": "tsc -p . && rollup -c rollup.config.js 2>&1",
"build:test": "tsc -p . && rollup -c 2>&1",
"build": "npm run extract-api && tsc -p . && rollup -c 2>&1",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples/**/*.{js,json}\"",
"clean": "rimraf dist dist-* typings *.tgz *.log",
Expand Down Expand Up @@ -56,6 +59,14 @@
"README.md",
"LICENSE"
],
"//metadata": {
"constantPaths": [
{
"path": "src/client/identityClient.ts",
"prefix": "packageDetails"
}
]
},
"engines": {
"node": ">=12.0.0"
},
Expand All @@ -79,9 +90,11 @@
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity/README.md",
"sideEffects": false,
"dependencies": {
"@azure/core-auth": "^1.3.0",
"@azure/core-http": "^2.0.0",
"@azure/core-util": "^1.0.0-beta.1",
"@azure/core-tracing": "1.0.0-preview.13",
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/logger": "^1.0.0",
"@azure/abort-controller": "^1.0.0",
"@azure/msal-common": "^4.3.0",
Expand All @@ -107,6 +120,8 @@
"@types/node": "^12.0.0",
"@types/qs": "^6.5.3",
"@types/uuid": "^8.0.0",
"@types/chai": "^4.1.6",
"chai": "^4.2.0",
"assert": "^1.4.1",
"cross-env": "^7.0.2",
"dotenv": "^8.2.0",
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/identity/review/identity.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import { AccessToken } from '@azure/core-auth';
import { AzureLogger } from '@azure/logger';
import { CommonClientOptions } from '@azure/core-client';
import { GetTokenOptions } from '@azure/core-auth';
import { PipelineOptions } from '@azure/core-http';
import { TokenCredential } from '@azure/core-auth';

export { AccessToken }
Expand Down Expand Up @@ -308,7 +308,7 @@ export interface TokenCachePersistenceOptions {
export { TokenCredential }

// @public
export interface TokenCredentialOptions extends PipelineOptions {
export interface TokenCredentialOptions extends CommonClientOptions {
allowMultiTenantAuthentication?: boolean;
authorityHost?: string;
}
Expand Down
Loading