Skip to content

Commit

Permalink
add @azure/core-util to resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Nov 1, 2023
1 parent 9fd7081 commit 9150495
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 35 deletions.
1 change: 1 addition & 0 deletions libraries/botframework-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@azure/identity": "^2.0.4",
"@azure/ms-rest-js": "^2.7.0",
"@azure/msal-node": "^1.2.0",
"@azure/core-http": "^3.0.2",
"axios": "^0.25.0",
"base64url": "^3.0.0",
"botbuilder-stdlib": "4.1.6",
Expand Down
15 changes: 6 additions & 9 deletions libraries/botframework-connector/src/auth/tokenCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { HttpHeaders, Constants, WebResourceLike, ServiceClientCredentials } from "@azure/core-http";
import { HttpHeaders, Constants, WebResourceLike, ServiceClientCredentials } from '@azure/core-http';

const HeaderConstants = Constants.HeaderConstants;
const DEFAULT_AUTHORIZATION_SCHEME = "Bearer";
const DEFAULT_AUTHORIZATION_SCHEME = 'Bearer';

/**
* A credentials object that uses a token string and a authorzation scheme to authenticate.
Expand All @@ -16,13 +16,13 @@ export class TokenCredentials implements ServiceClientCredentials {
/**
* Creates a new TokenCredentials object.
*
* @constructor
* @class
* @param {string} token The token.
* @param {string} [authorizationScheme] The authorization scheme.
*/
constructor(token: string, authorizationScheme: string = DEFAULT_AUTHORIZATION_SCHEME) {
if (!token) {
throw new Error("token cannot be null or undefined.");
throw new Error('token cannot be null or undefined.');
}
this.token = token;
this.authorizationScheme = authorizationScheme;
Expand All @@ -32,14 +32,11 @@ export class TokenCredentials implements ServiceClientCredentials {
* Signs a request with the Authentication header.
*
* @param {WebResourceLike} webResource The WebResourceLike to be signed.
* @return {Promise<WebResourceLike>} The signed request object.
* @returns {Promise<WebResourceLike>} The signed request object.
*/
signRequest(webResource: WebResourceLike) {
if (!webResource.headers) webResource.headers = new HttpHeaders();
webResource.headers.set(
HeaderConstants.AUTHORIZATION,
`${this.authorizationScheme} ${this.token}`
);
webResource.headers.set(HeaderConstants.AUTHORIZATION, `${this.authorizationScheme} ${this.token}`);
return Promise.resolve(webResource);
}
}
3 changes: 2 additions & 1 deletion libraries/tests.uischema
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"triggers",
"generator",
"selector",
"schema"
"schema",
"dialogs"
],
"label": "Adaptive dialog",
"order": [
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"**/botbuilder-azure/@azure/core-auth/@azure/core-tracing": "1.0.0-preview.9",
"**/request/tough-cookie": "^4.1.3",
"**/request-promise/tough-cookie": "^4.1.3",
"**/request-promise-native/tough-cookie": "^4.1.3"
"**/request-promise-native/tough-cookie": "^4.1.3",
"@azure/core-util": "1.5.0"
},
"devDependencies": {
"@azure/logger": "^1.0.2",
Expand Down
25 changes: 1 addition & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,7 @@
"@opentelemetry/api" "^0.10.2"
tslib "^2.0.0"

"@azure/core-util@^1.0.0-beta.1":
version "1.0.0-beta.1"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.0.0-beta.1.tgz#2efd2c74b4b0a38180369f50fe274a3c4cd36e98"
integrity sha512-pS6cup979/qyuyNP9chIybK2qVkJ3MarbY/bx3JcGKE6An6dRweLnsfJfU2ydqUI/B51Rjnn59ajHIhCUTwWZw==
dependencies:
tslib "^2.0.0"

"@azure/core-util@^1.1.0":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.6.1.tgz#fea221c4fa43c26543bccf799beb30c1c7878f5a"
integrity sha512-h5taHeySlsV9qxuK64KZxy4iln1BtMYlNt5jbuEFN3UFSAd1EwKg/Gjl5a6tZ/W8t6li3xPnutOx7zbDyXnPmQ==
dependencies:
"@azure/abort-controller" "^1.0.0"
tslib "^2.2.0"

"@azure/core-util@^1.1.1":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.3.2.tgz#3f8cfda1e87fac0ce84f8c1a42fcd6d2a986632d"
integrity sha512-2bECOUh88RvL1pMZTcc6OzfobBeWDBf5oBbhjIhT1MV9otMVWCzpOJkkiKtrnO88y5GGBelgY8At73KGAdbkeQ==
dependencies:
"@azure/abort-controller" "^1.0.0"
tslib "^2.2.0"

"@azure/core-util@^1.2.0":
"@azure/[email protected]", "@azure/core-util@^1.0.0-beta.1", "@azure/core-util@^1.1.0", "@azure/core-util@^1.1.1", "@azure/core-util@^1.2.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.5.0.tgz#ffe49c3e867044da67daeb8122143fa065e1eb0e"
integrity sha512-GZBpVFDtQ/15hW1OgBcRdT4Bl7AEpcEZqLfbAvOtm1CQUncKWiYapFHVD588hmlV27NbOOtSm3cnLF3lvoHi4g==
Expand Down

0 comments on commit 9150495

Please sign in to comment.