Merge pull request #132 from deyaaeldeen/use-token-cred

Add TokenCredential as part of the type of the credentials input
This commit is contained in:
Jose Manuel Heredia Hidalgo 2021-01-26 14:52:59 -08:00 коммит произвёл GitHub
Родитель adbde2a378 2b7e6bc4a6
Коммит a9cee4480a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -1,4 +1,7 @@
# Changelog
## 2.1.0 - 2021-01-26
- Added support for @azure/identity's TokenCredential. For more information, see https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md#credentials
## 2.0.1 - 2019-07-30
- In `getOperationResponse()` if the `resource` is of type `string` and we get an error while performing `JSON.parse()` then instead of letting the error be thrown we set the `resource` as-is as the `response.parsedBody`
@ -85,4 +88,4 @@
- Initial version of the isomorphic azure runtime along with type definitions that works in the browser as well as the node.js environment
- Supports polling for long running operations
- Provides definition of CloudError
- Provides definition of CloudError

Просмотреть файл

@ -2,6 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest } from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import { createLROPollerFromInitialResponse, createLROPollerFromPollState, LROPoller } from "./lroPoller";
import { LROPollState } from "./lroPollStrategy";
import * as Constants from "./util/constants";
@ -38,12 +39,12 @@ export class AzureServiceClient extends ServiceClient {
*/
public longRunningOperationRetryTimeout?: number;
constructor(credentials: ServiceClientCredentials, options?: AzureServiceClientOptions) {
constructor(credentials: ServiceClientCredentials | TokenCredential, options?: AzureServiceClientOptions) {
super(credentials, options = updateOptionsWithDefaultValues(options));
// For convenience, if the credentials have an associated AzureEnvironment,
// automatically use the baseUri from that environment.
const env = (credentials as any).environment;
const env = (credentials as any)?.environment;
if (env && !this.baseUri) {
this.baseUri = env.resourceManagerEndpointUrl;
}

Просмотреть файл

@ -27,4 +27,4 @@ export const DEFAULT_LANGUAGE = "en-us";
* @const
* @type {string}
*/
export const msRestAzureVersion = "2.0.1";
export const msRestAzureVersion = "2.1.0";

Просмотреть файл

@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/ms-rest-azure-js"
},
"version": "2.0.2",
"version": "2.1.0",
"description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
"tags": [
"isomorphic",
@ -41,7 +41,8 @@
],
"license": "MIT",
"dependencies": {
"@azure/ms-rest-js": "^2.0.4",
"@azure/core-auth": "^1.1.4",
"@azure/ms-rest-js": "^2.2.0",
"tslib": "^1.10.0"
},
"devDependencies": {