@azure/core-auth 1.8.1-alpha.20241015.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +0 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/tokenCredential.d.ts +36 -0
- package/dist/browser/tokenCredential.d.ts.map +1 -1
- package/dist/browser/tokenCredential.js +16 -0
- package/dist/browser/tokenCredential.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/tokenCredential.d.ts +36 -0
- package/dist/commonjs/tokenCredential.d.ts.map +1 -1
- package/dist/commonjs/tokenCredential.js +18 -0
- package/dist/commonjs/tokenCredential.js.map +1 -1
- package/dist/core-auth.d.ts +26 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tokenCredential.d.ts +36 -0
- package/dist/esm/tokenCredential.d.ts.map +1 -1
- package/dist/esm/tokenCredential.js +16 -0
- package/dist/esm/tokenCredential.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -0
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +0 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/tokenCredential.d.ts +36 -0
- package/dist/react-native/tokenCredential.d.ts.map +1 -1
- package/dist/react-native/tokenCredential.js +16 -0
- package/dist/react-native/tokenCredential.js.map +1 -1
- package/package.json +4 -4
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { HttpMethods } from "@azure/core-util";
|
|
1
2
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
2
3
|
export { KeyCredential, isKeyCredential } from "./keyCredential.js";
|
|
3
4
|
export { AzureNamedKeyCredential, NamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
1
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
4
2
|
export { isKeyCredential } from "./keyCredential.js";
|
|
5
3
|
export { AzureNamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EAEvB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAIL,iBAAiB,GAClB,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nexport { HttpMethods } from \"@azure/core-util\";\nexport { AzureKeyCredential } from \"./azureKeyCredential.js\";\nexport { KeyCredential, isKeyCredential } from \"./keyCredential.js\";\nexport {\n AzureNamedKeyCredential,\n NamedKeyCredential,\n isNamedKeyCredential,\n} from \"./azureNamedKeyCredential.js\";\nexport { AzureSASCredential, SASCredential, isSASCredential } from \"./azureSASCredential.js\";\n\nexport {\n TokenCredential,\n GetTokenOptions,\n AccessToken,\n isTokenCredential,\n} from \"./tokenCredential.js\";\n\nexport { TracingContext } from \"./tracing.js\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
2
|
import { TracingContext } from "./tracing.js";
|
|
3
|
+
import { HttpMethods } from "@azure/core-util";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a credential capable of providing an authentication token.
|
|
5
6
|
*/
|
|
@@ -54,6 +55,27 @@ export interface GetTokenOptions {
|
|
|
54
55
|
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
55
56
|
*/
|
|
56
57
|
tenantId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Options for Proof of Possession token requests
|
|
60
|
+
*/
|
|
61
|
+
proofOfPossessionOptions?: {
|
|
62
|
+
/**
|
|
63
|
+
* The nonce value required for PoP token requests.
|
|
64
|
+
* This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
|
|
65
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
|
|
66
|
+
*/
|
|
67
|
+
nonce: string;
|
|
68
|
+
/**
|
|
69
|
+
* The HTTP method of the request.
|
|
70
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
|
|
71
|
+
*/
|
|
72
|
+
resourceRequestMethod: HttpMethods;
|
|
73
|
+
/**
|
|
74
|
+
* The URL of the request.
|
|
75
|
+
* This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
|
|
76
|
+
*/
|
|
77
|
+
resourceRequestUrl: string;
|
|
78
|
+
};
|
|
57
79
|
}
|
|
58
80
|
/**
|
|
59
81
|
* Represents an access token with an expiration time.
|
|
@@ -71,7 +93,21 @@ export interface AccessToken {
|
|
|
71
93
|
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
72
94
|
*/
|
|
73
95
|
refreshAfterTimestamp?: number;
|
|
96
|
+
/** Type of token - `Bearer` or `pop` */
|
|
97
|
+
tokenType?: "Bearer" | "pop";
|
|
74
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* @param accessToken - Access token
|
|
102
|
+
* @returns Whether a token is bearer type or not
|
|
103
|
+
*/
|
|
104
|
+
export declare function isBearerToken(accessToken: AccessToken): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
* @param accessToken - Access token
|
|
108
|
+
* @returns Whether a token is Pop token or not
|
|
109
|
+
*/
|
|
110
|
+
export declare function isPopToken(accessToken: AccessToken): boolean;
|
|
75
111
|
/**
|
|
76
112
|
* Tests an object to determine whether it implements TokenCredential.
|
|
77
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,wBAAwB,CAAC,EAAE;QACzB;;;;WAIG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,qBAAqB,EAAE,WAAW,CAAC;QACnC;;;WAGG;QACH,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,eAAe,CAepF"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* @param accessToken - Access token
|
|
6
|
+
* @returns Whether a token is bearer type or not
|
|
7
|
+
*/
|
|
8
|
+
export function isBearerToken(accessToken) {
|
|
9
|
+
return !accessToken.tokenType || accessToken.tokenType === "Bearer";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* @param accessToken - Access token
|
|
14
|
+
* @returns Whether a token is Pop token or not
|
|
15
|
+
*/
|
|
16
|
+
export function isPopToken(accessToken) {
|
|
17
|
+
return accessToken.tokenType === "pop";
|
|
18
|
+
}
|
|
3
19
|
/**
|
|
4
20
|
* Tests an object to determine whether it implements TokenCredential.
|
|
5
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4GlC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,WAAwB;IACpD,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,QAAQ,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,WAAwB;IACjD,OAAO,WAAW,CAAC,SAAS,KAAK,KAAK,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,qEAAqE;IACrE,sDAAsD;IACtD,MAAM,cAAc,GAAG,UAGtB,CAAC;IACF,OAAO,CACL,cAAc;QACd,OAAO,cAAc,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { TracingContext } from \"./tracing.js\";\nimport { HttpMethods } from \"@azure/core-util\";\n\n/**\n * Represents a credential capable of providing an authentication token.\n */\nexport interface TokenCredential {\n /**\n * Gets the token provided by this credential.\n *\n * This method is called automatically by Azure SDK client libraries. You may call this method\n * directly, but you must also handle token caching and token refreshing.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;\n}\n\n/**\n * Defines options for TokenCredential.getToken.\n */\nexport interface GetTokenOptions {\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Options used when creating and sending HTTP requests for this operation.\n */\n requestOptions?: {\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n */\n timeout?: number;\n };\n /**\n * Options used when tracing is enabled.\n */\n tracingOptions?: {\n /**\n * Tracing Context for the current request.\n */\n tracingContext?: TracingContext;\n };\n /**\n * Claim details to perform the Continuous Access Evaluation authentication flow\n */\n claims?: string;\n /**\n * Indicates whether to enable the Continuous Access Evaluation authentication flow\n */\n enableCae?: boolean;\n /**\n * Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.\n */\n tenantId?: string;\n\n /**\n * Options for Proof of Possession token requests\n */\n proofOfPossessionOptions?: {\n /**\n * The nonce value required for PoP token requests.\n * This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.\n * This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.\n */\n nonce: string;\n /**\n * The HTTP method of the request.\n * This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.\n */\n resourceRequestMethod: HttpMethods;\n /**\n * The URL of the request.\n * This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.\n */\n resourceRequestUrl: string;\n };\n}\n\n/**\n * Represents an access token with an expiration time.\n */\nexport interface AccessToken {\n /**\n * The access token returned by the authentication service.\n */\n token: string;\n\n /**\n * The access token's expiration timestamp in milliseconds, UNIX epoch time.\n */\n expiresOnTimestamp: number;\n\n /**\n * The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.\n */\n refreshAfterTimestamp?: number;\n\n /** Type of token - `Bearer` or `pop` */\n tokenType?: \"Bearer\" | \"pop\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is bearer type or not\n */\nexport function isBearerToken(accessToken: AccessToken): boolean {\n return !accessToken.tokenType || accessToken.tokenType === \"Bearer\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is Pop token or not\n */\nexport function isPopToken(accessToken: AccessToken): boolean {\n return accessToken.tokenType === \"pop\";\n}\n\n/**\n * Tests an object to determine whether it implements TokenCredential.\n *\n * @param credential - The assumed TokenCredential to be tested.\n */\nexport function isTokenCredential(credential: unknown): credential is TokenCredential {\n // Check for an object with a 'getToken' function and possibly with\n // a 'signRequest' function. We do this check to make sure that\n // a ServiceClientCredentials implementor (like TokenClientCredentials\n // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if\n // it doesn't actually implement TokenCredential also.\n const castCredential = credential as {\n getToken: unknown;\n signRequest: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.getToken === \"function\" &&\n (castCredential.signRequest === undefined || castCredential.getToken.length > 0)\n );\n}\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { HttpMethods } from "@azure/core-util";
|
|
1
2
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
2
3
|
export { KeyCredential, isKeyCredential } from "./keyCredential.js";
|
|
3
4
|
export { AzureNamedKeyCredential, NamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT License.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.isTokenCredential = exports.isSASCredential = exports.AzureSASCredential = exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = exports.isKeyCredential = exports.AzureKeyCredential = void 0;
|
|
6
4
|
var azureKeyCredential_js_1 = require("./azureKeyCredential.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAGA,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,uDAAoE;AAA5C,mHAAA,eAAe,OAAA;AACvC,2EAIsC;AAHpC,qIAAA,uBAAuB,OAAA;AAEvB,kIAAA,oBAAoB,OAAA;AAEtB,iEAA6F;AAApF,2HAAA,kBAAkB,OAAA;AAAiB,wHAAA,eAAe,OAAA;AAE3D,2DAK8B;AAD5B,uHAAA,iBAAiB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nexport { HttpMethods } from \"@azure/core-util\";\nexport { AzureKeyCredential } from \"./azureKeyCredential.js\";\nexport { KeyCredential, isKeyCredential } from \"./keyCredential.js\";\nexport {\n AzureNamedKeyCredential,\n NamedKeyCredential,\n isNamedKeyCredential,\n} from \"./azureNamedKeyCredential.js\";\nexport { AzureSASCredential, SASCredential, isSASCredential } from \"./azureSASCredential.js\";\n\nexport {\n TokenCredential,\n GetTokenOptions,\n AccessToken,\n isTokenCredential,\n} from \"./tokenCredential.js\";\n\nexport { TracingContext } from \"./tracing.js\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
2
|
import { TracingContext } from "./tracing.js";
|
|
3
|
+
import { HttpMethods } from "@azure/core-util";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a credential capable of providing an authentication token.
|
|
5
6
|
*/
|
|
@@ -54,6 +55,27 @@ export interface GetTokenOptions {
|
|
|
54
55
|
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
55
56
|
*/
|
|
56
57
|
tenantId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Options for Proof of Possession token requests
|
|
60
|
+
*/
|
|
61
|
+
proofOfPossessionOptions?: {
|
|
62
|
+
/**
|
|
63
|
+
* The nonce value required for PoP token requests.
|
|
64
|
+
* This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
|
|
65
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
|
|
66
|
+
*/
|
|
67
|
+
nonce: string;
|
|
68
|
+
/**
|
|
69
|
+
* The HTTP method of the request.
|
|
70
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
|
|
71
|
+
*/
|
|
72
|
+
resourceRequestMethod: HttpMethods;
|
|
73
|
+
/**
|
|
74
|
+
* The URL of the request.
|
|
75
|
+
* This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
|
|
76
|
+
*/
|
|
77
|
+
resourceRequestUrl: string;
|
|
78
|
+
};
|
|
57
79
|
}
|
|
58
80
|
/**
|
|
59
81
|
* Represents an access token with an expiration time.
|
|
@@ -71,7 +93,21 @@ export interface AccessToken {
|
|
|
71
93
|
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
72
94
|
*/
|
|
73
95
|
refreshAfterTimestamp?: number;
|
|
96
|
+
/** Type of token - `Bearer` or `pop` */
|
|
97
|
+
tokenType?: "Bearer" | "pop";
|
|
74
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* @param accessToken - Access token
|
|
102
|
+
* @returns Whether a token is bearer type or not
|
|
103
|
+
*/
|
|
104
|
+
export declare function isBearerToken(accessToken: AccessToken): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
* @param accessToken - Access token
|
|
108
|
+
* @returns Whether a token is Pop token or not
|
|
109
|
+
*/
|
|
110
|
+
export declare function isPopToken(accessToken: AccessToken): boolean;
|
|
75
111
|
/**
|
|
76
112
|
* Tests an object to determine whether it implements TokenCredential.
|
|
77
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,wBAAwB,CAAC,EAAE;QACzB;;;;WAIG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,qBAAqB,EAAE,WAAW,CAAC;QACnC;;;WAGG;QACH,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,eAAe,CAepF"}
|
|
@@ -2,7 +2,25 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.isBearerToken = isBearerToken;
|
|
6
|
+
exports.isPopToken = isPopToken;
|
|
5
7
|
exports.isTokenCredential = isTokenCredential;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
* @param accessToken - Access token
|
|
11
|
+
* @returns Whether a token is bearer type or not
|
|
12
|
+
*/
|
|
13
|
+
function isBearerToken(accessToken) {
|
|
14
|
+
return !accessToken.tokenType || accessToken.tokenType === "Bearer";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
* @param accessToken - Access token
|
|
19
|
+
* @returns Whether a token is Pop token or not
|
|
20
|
+
*/
|
|
21
|
+
function isPopToken(accessToken) {
|
|
22
|
+
return accessToken.tokenType === "pop";
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Tests an object to determine whether it implements TokenCredential.
|
|
8
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiHlC,sCAEC;AAOD,gCAEC;AAOD,8CAeC;AAtCD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,WAAwB;IACpD,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,QAAQ,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,WAAwB;IACjD,OAAO,WAAW,CAAC,SAAS,KAAK,KAAK,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAmB;IACnD,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,qEAAqE;IACrE,sDAAsD;IACtD,MAAM,cAAc,GAAG,UAGtB,CAAC;IACF,OAAO,CACL,cAAc;QACd,OAAO,cAAc,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { TracingContext } from \"./tracing.js\";\nimport { HttpMethods } from \"@azure/core-util\";\n\n/**\n * Represents a credential capable of providing an authentication token.\n */\nexport interface TokenCredential {\n /**\n * Gets the token provided by this credential.\n *\n * This method is called automatically by Azure SDK client libraries. You may call this method\n * directly, but you must also handle token caching and token refreshing.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;\n}\n\n/**\n * Defines options for TokenCredential.getToken.\n */\nexport interface GetTokenOptions {\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Options used when creating and sending HTTP requests for this operation.\n */\n requestOptions?: {\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n */\n timeout?: number;\n };\n /**\n * Options used when tracing is enabled.\n */\n tracingOptions?: {\n /**\n * Tracing Context for the current request.\n */\n tracingContext?: TracingContext;\n };\n /**\n * Claim details to perform the Continuous Access Evaluation authentication flow\n */\n claims?: string;\n /**\n * Indicates whether to enable the Continuous Access Evaluation authentication flow\n */\n enableCae?: boolean;\n /**\n * Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.\n */\n tenantId?: string;\n\n /**\n * Options for Proof of Possession token requests\n */\n proofOfPossessionOptions?: {\n /**\n * The nonce value required for PoP token requests.\n * This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.\n * This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.\n */\n nonce: string;\n /**\n * The HTTP method of the request.\n * This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.\n */\n resourceRequestMethod: HttpMethods;\n /**\n * The URL of the request.\n * This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.\n */\n resourceRequestUrl: string;\n };\n}\n\n/**\n * Represents an access token with an expiration time.\n */\nexport interface AccessToken {\n /**\n * The access token returned by the authentication service.\n */\n token: string;\n\n /**\n * The access token's expiration timestamp in milliseconds, UNIX epoch time.\n */\n expiresOnTimestamp: number;\n\n /**\n * The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.\n */\n refreshAfterTimestamp?: number;\n\n /** Type of token - `Bearer` or `pop` */\n tokenType?: \"Bearer\" | \"pop\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is bearer type or not\n */\nexport function isBearerToken(accessToken: AccessToken): boolean {\n return !accessToken.tokenType || accessToken.tokenType === \"Bearer\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is Pop token or not\n */\nexport function isPopToken(accessToken: AccessToken): boolean {\n return accessToken.tokenType === \"pop\";\n}\n\n/**\n * Tests an object to determine whether it implements TokenCredential.\n *\n * @param credential - The assumed TokenCredential to be tested.\n */\nexport function isTokenCredential(credential: unknown): credential is TokenCredential {\n // Check for an object with a 'getToken' function and possibly with\n // a 'signRequest' function. We do this check to make sure that\n // a ServiceClientCredentials implementor (like TokenClientCredentials\n // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if\n // it doesn't actually implement TokenCredential also.\n const castCredential = credential as {\n getToken: unknown;\n signRequest: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.getToken === \"function\" &&\n (castCredential.signRequest === undefined || castCredential.getToken.length > 0)\n );\n}\n"]}
|
package/dist/core-auth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbortSignalLike } from '@azure/abort-controller';
|
|
2
|
+
import { HttpMethods } from '@azure/core-util';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Represents an access token with an expiration time.
|
|
@@ -16,6 +17,8 @@ export declare interface AccessToken {
|
|
|
16
17
|
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
17
18
|
*/
|
|
18
19
|
refreshAfterTimestamp?: number;
|
|
20
|
+
/** Type of token - `Bearer` or `pop` */
|
|
21
|
+
tokenType?: "Bearer" | "pop";
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/**
|
|
@@ -147,8 +150,31 @@ export declare interface GetTokenOptions {
|
|
|
147
150
|
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
148
151
|
*/
|
|
149
152
|
tenantId?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Options for Proof of Possession token requests
|
|
155
|
+
*/
|
|
156
|
+
proofOfPossessionOptions?: {
|
|
157
|
+
/**
|
|
158
|
+
* The nonce value required for PoP token requests.
|
|
159
|
+
* This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
|
|
160
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
|
|
161
|
+
*/
|
|
162
|
+
nonce: string;
|
|
163
|
+
/**
|
|
164
|
+
* The HTTP method of the request.
|
|
165
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
|
|
166
|
+
*/
|
|
167
|
+
resourceRequestMethod: HttpMethods;
|
|
168
|
+
/**
|
|
169
|
+
* The URL of the request.
|
|
170
|
+
* This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
|
|
171
|
+
*/
|
|
172
|
+
resourceRequestUrl: string;
|
|
173
|
+
};
|
|
150
174
|
}
|
|
151
175
|
|
|
176
|
+
export { HttpMethods }
|
|
177
|
+
|
|
152
178
|
/**
|
|
153
179
|
* Tests an object to determine whether it implements KeyCredential.
|
|
154
180
|
*
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { HttpMethods } from "@azure/core-util";
|
|
1
2
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
2
3
|
export { KeyCredential, isKeyCredential } from "./keyCredential.js";
|
|
3
4
|
export { AzureNamedKeyCredential, NamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
1
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
4
2
|
export { isKeyCredential } from "./keyCredential.js";
|
|
5
3
|
export { AzureNamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EAEvB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAIL,iBAAiB,GAClB,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nexport { HttpMethods } from \"@azure/core-util\";\nexport { AzureKeyCredential } from \"./azureKeyCredential.js\";\nexport { KeyCredential, isKeyCredential } from \"./keyCredential.js\";\nexport {\n AzureNamedKeyCredential,\n NamedKeyCredential,\n isNamedKeyCredential,\n} from \"./azureNamedKeyCredential.js\";\nexport { AzureSASCredential, SASCredential, isSASCredential } from \"./azureSASCredential.js\";\n\nexport {\n TokenCredential,\n GetTokenOptions,\n AccessToken,\n isTokenCredential,\n} from \"./tokenCredential.js\";\n\nexport { TracingContext } from \"./tracing.js\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
2
|
import { TracingContext } from "./tracing.js";
|
|
3
|
+
import { HttpMethods } from "@azure/core-util";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a credential capable of providing an authentication token.
|
|
5
6
|
*/
|
|
@@ -54,6 +55,27 @@ export interface GetTokenOptions {
|
|
|
54
55
|
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
55
56
|
*/
|
|
56
57
|
tenantId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Options for Proof of Possession token requests
|
|
60
|
+
*/
|
|
61
|
+
proofOfPossessionOptions?: {
|
|
62
|
+
/**
|
|
63
|
+
* The nonce value required for PoP token requests.
|
|
64
|
+
* This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
|
|
65
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
|
|
66
|
+
*/
|
|
67
|
+
nonce: string;
|
|
68
|
+
/**
|
|
69
|
+
* The HTTP method of the request.
|
|
70
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
|
|
71
|
+
*/
|
|
72
|
+
resourceRequestMethod: HttpMethods;
|
|
73
|
+
/**
|
|
74
|
+
* The URL of the request.
|
|
75
|
+
* This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
|
|
76
|
+
*/
|
|
77
|
+
resourceRequestUrl: string;
|
|
78
|
+
};
|
|
57
79
|
}
|
|
58
80
|
/**
|
|
59
81
|
* Represents an access token with an expiration time.
|
|
@@ -71,7 +93,21 @@ export interface AccessToken {
|
|
|
71
93
|
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
72
94
|
*/
|
|
73
95
|
refreshAfterTimestamp?: number;
|
|
96
|
+
/** Type of token - `Bearer` or `pop` */
|
|
97
|
+
tokenType?: "Bearer" | "pop";
|
|
74
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* @param accessToken - Access token
|
|
102
|
+
* @returns Whether a token is bearer type or not
|
|
103
|
+
*/
|
|
104
|
+
export declare function isBearerToken(accessToken: AccessToken): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
* @param accessToken - Access token
|
|
108
|
+
* @returns Whether a token is Pop token or not
|
|
109
|
+
*/
|
|
110
|
+
export declare function isPopToken(accessToken: AccessToken): boolean;
|
|
75
111
|
/**
|
|
76
112
|
* Tests an object to determine whether it implements TokenCredential.
|
|
77
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,wBAAwB,CAAC,EAAE;QACzB;;;;WAIG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,qBAAqB,EAAE,WAAW,CAAC;QACnC;;;WAGG;QACH,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,eAAe,CAepF"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* @param accessToken - Access token
|
|
6
|
+
* @returns Whether a token is bearer type or not
|
|
7
|
+
*/
|
|
8
|
+
export function isBearerToken(accessToken) {
|
|
9
|
+
return !accessToken.tokenType || accessToken.tokenType === "Bearer";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* @param accessToken - Access token
|
|
14
|
+
* @returns Whether a token is Pop token or not
|
|
15
|
+
*/
|
|
16
|
+
export function isPopToken(accessToken) {
|
|
17
|
+
return accessToken.tokenType === "pop";
|
|
18
|
+
}
|
|
3
19
|
/**
|
|
4
20
|
* Tests an object to determine whether it implements TokenCredential.
|
|
5
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4GlC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,WAAwB;IACpD,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,QAAQ,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,WAAwB;IACjD,OAAO,WAAW,CAAC,SAAS,KAAK,KAAK,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,qEAAqE;IACrE,sDAAsD;IACtD,MAAM,cAAc,GAAG,UAGtB,CAAC;IACF,OAAO,CACL,cAAc;QACd,OAAO,cAAc,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { TracingContext } from \"./tracing.js\";\nimport { HttpMethods } from \"@azure/core-util\";\n\n/**\n * Represents a credential capable of providing an authentication token.\n */\nexport interface TokenCredential {\n /**\n * Gets the token provided by this credential.\n *\n * This method is called automatically by Azure SDK client libraries. You may call this method\n * directly, but you must also handle token caching and token refreshing.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;\n}\n\n/**\n * Defines options for TokenCredential.getToken.\n */\nexport interface GetTokenOptions {\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Options used when creating and sending HTTP requests for this operation.\n */\n requestOptions?: {\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n */\n timeout?: number;\n };\n /**\n * Options used when tracing is enabled.\n */\n tracingOptions?: {\n /**\n * Tracing Context for the current request.\n */\n tracingContext?: TracingContext;\n };\n /**\n * Claim details to perform the Continuous Access Evaluation authentication flow\n */\n claims?: string;\n /**\n * Indicates whether to enable the Continuous Access Evaluation authentication flow\n */\n enableCae?: boolean;\n /**\n * Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.\n */\n tenantId?: string;\n\n /**\n * Options for Proof of Possession token requests\n */\n proofOfPossessionOptions?: {\n /**\n * The nonce value required for PoP token requests.\n * This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.\n * This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.\n */\n nonce: string;\n /**\n * The HTTP method of the request.\n * This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.\n */\n resourceRequestMethod: HttpMethods;\n /**\n * The URL of the request.\n * This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.\n */\n resourceRequestUrl: string;\n };\n}\n\n/**\n * Represents an access token with an expiration time.\n */\nexport interface AccessToken {\n /**\n * The access token returned by the authentication service.\n */\n token: string;\n\n /**\n * The access token's expiration timestamp in milliseconds, UNIX epoch time.\n */\n expiresOnTimestamp: number;\n\n /**\n * The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.\n */\n refreshAfterTimestamp?: number;\n\n /** Type of token - `Bearer` or `pop` */\n tokenType?: \"Bearer\" | \"pop\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is bearer type or not\n */\nexport function isBearerToken(accessToken: AccessToken): boolean {\n return !accessToken.tokenType || accessToken.tokenType === \"Bearer\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is Pop token or not\n */\nexport function isPopToken(accessToken: AccessToken): boolean {\n return accessToken.tokenType === \"pop\";\n}\n\n/**\n * Tests an object to determine whether it implements TokenCredential.\n *\n * @param credential - The assumed TokenCredential to be tested.\n */\nexport function isTokenCredential(credential: unknown): credential is TokenCredential {\n // Check for an object with a 'getToken' function and possibly with\n // a 'signRequest' function. We do this check to make sure that\n // a ServiceClientCredentials implementor (like TokenClientCredentials\n // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if\n // it doesn't actually implement TokenCredential also.\n const castCredential = credential as {\n getToken: unknown;\n signRequest: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.getToken === \"function\" &&\n (castCredential.signRequest === undefined || castCredential.getToken.length > 0)\n );\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { HttpMethods } from "@azure/core-util";
|
|
1
2
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
2
3
|
export { KeyCredential, isKeyCredential } from "./keyCredential.js";
|
|
3
4
|
export { AzureNamedKeyCredential, NamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
1
|
export { AzureKeyCredential } from "./azureKeyCredential.js";
|
|
4
2
|
export { isKeyCredential } from "./keyCredential.js";
|
|
5
3
|
export { AzureNamedKeyCredential, isNamedKeyCredential, } from "./azureNamedKeyCredential.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,uBAAuB,EAEvB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAIL,iBAAiB,GAClB,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nexport { HttpMethods } from \"@azure/core-util\";\nexport { AzureKeyCredential } from \"./azureKeyCredential.js\";\nexport { KeyCredential, isKeyCredential } from \"./keyCredential.js\";\nexport {\n AzureNamedKeyCredential,\n NamedKeyCredential,\n isNamedKeyCredential,\n} from \"./azureNamedKeyCredential.js\";\nexport { AzureSASCredential, SASCredential, isSASCredential } from \"./azureSASCredential.js\";\n\nexport {\n TokenCredential,\n GetTokenOptions,\n AccessToken,\n isTokenCredential,\n} from \"./tokenCredential.js\";\n\nexport { TracingContext } from \"./tracing.js\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
2
|
import { TracingContext } from "./tracing.js";
|
|
3
|
+
import { HttpMethods } from "@azure/core-util";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a credential capable of providing an authentication token.
|
|
5
6
|
*/
|
|
@@ -54,6 +55,27 @@ export interface GetTokenOptions {
|
|
|
54
55
|
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
55
56
|
*/
|
|
56
57
|
tenantId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Options for Proof of Possession token requests
|
|
60
|
+
*/
|
|
61
|
+
proofOfPossessionOptions?: {
|
|
62
|
+
/**
|
|
63
|
+
* The nonce value required for PoP token requests.
|
|
64
|
+
* This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.
|
|
65
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.
|
|
66
|
+
*/
|
|
67
|
+
nonce: string;
|
|
68
|
+
/**
|
|
69
|
+
* The HTTP method of the request.
|
|
70
|
+
* This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.
|
|
71
|
+
*/
|
|
72
|
+
resourceRequestMethod: HttpMethods;
|
|
73
|
+
/**
|
|
74
|
+
* The URL of the request.
|
|
75
|
+
* This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.
|
|
76
|
+
*/
|
|
77
|
+
resourceRequestUrl: string;
|
|
78
|
+
};
|
|
57
79
|
}
|
|
58
80
|
/**
|
|
59
81
|
* Represents an access token with an expiration time.
|
|
@@ -71,7 +93,21 @@ export interface AccessToken {
|
|
|
71
93
|
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
72
94
|
*/
|
|
73
95
|
refreshAfterTimestamp?: number;
|
|
96
|
+
/** Type of token - `Bearer` or `pop` */
|
|
97
|
+
tokenType?: "Bearer" | "pop";
|
|
74
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* @param accessToken - Access token
|
|
102
|
+
* @returns Whether a token is bearer type or not
|
|
103
|
+
*/
|
|
104
|
+
export declare function isBearerToken(accessToken: AccessToken): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
* @param accessToken - Access token
|
|
108
|
+
* @returns Whether a token is Pop token or not
|
|
109
|
+
*/
|
|
110
|
+
export declare function isPopToken(accessToken: AccessToken): boolean;
|
|
75
111
|
/**
|
|
76
112
|
* Tests an object to determine whether it implements TokenCredential.
|
|
77
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.d.ts","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,wBAAwB,CAAC,EAAE;QACzB;;;;WAIG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,qBAAqB,EAAE,WAAW,CAAC;QACnC;;;WAGG;QACH,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,eAAe,CAepF"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* @param accessToken - Access token
|
|
6
|
+
* @returns Whether a token is bearer type or not
|
|
7
|
+
*/
|
|
8
|
+
export function isBearerToken(accessToken) {
|
|
9
|
+
return !accessToken.tokenType || accessToken.tokenType === "Bearer";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* @param accessToken - Access token
|
|
14
|
+
* @returns Whether a token is Pop token or not
|
|
15
|
+
*/
|
|
16
|
+
export function isPopToken(accessToken) {
|
|
17
|
+
return accessToken.tokenType === "pop";
|
|
18
|
+
}
|
|
3
19
|
/**
|
|
4
20
|
* Tests an object to determine whether it implements TokenCredential.
|
|
5
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"tokenCredential.js","sourceRoot":"","sources":["../../src/tokenCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA4GlC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,WAAwB;IACpD,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,QAAQ,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,WAAwB;IACjD,OAAO,WAAW,CAAC,SAAS,KAAK,KAAK,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,qEAAqE;IACrE,sDAAsD;IACtD,MAAM,cAAc,GAAG,UAGtB,CAAC;IACF,OAAO,CACL,cAAc;QACd,OAAO,cAAc,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { TracingContext } from \"./tracing.js\";\nimport { HttpMethods } from \"@azure/core-util\";\n\n/**\n * Represents a credential capable of providing an authentication token.\n */\nexport interface TokenCredential {\n /**\n * Gets the token provided by this credential.\n *\n * This method is called automatically by Azure SDK client libraries. You may call this method\n * directly, but you must also handle token caching and token refreshing.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;\n}\n\n/**\n * Defines options for TokenCredential.getToken.\n */\nexport interface GetTokenOptions {\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Options used when creating and sending HTTP requests for this operation.\n */\n requestOptions?: {\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n */\n timeout?: number;\n };\n /**\n * Options used when tracing is enabled.\n */\n tracingOptions?: {\n /**\n * Tracing Context for the current request.\n */\n tracingContext?: TracingContext;\n };\n /**\n * Claim details to perform the Continuous Access Evaluation authentication flow\n */\n claims?: string;\n /**\n * Indicates whether to enable the Continuous Access Evaluation authentication flow\n */\n enableCae?: boolean;\n /**\n * Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.\n */\n tenantId?: string;\n\n /**\n * Options for Proof of Possession token requests\n */\n proofOfPossessionOptions?: {\n /**\n * The nonce value required for PoP token requests.\n * This is typically retrieved from the WWW-Authenticate header of a 401 challenge response.\n * This is used in combination with {@link resourceRequestUrl} and {@link resourceRequestMethod} to generate the PoP token.\n */\n nonce: string;\n /**\n * The HTTP method of the request.\n * This is used in combination with {@link resourceRequestUrl} and {@link nonce} to generate the PoP token.\n */\n resourceRequestMethod: HttpMethods;\n /**\n * The URL of the request.\n * This is used in combination with {@link resourceRequestMethod} and {@link nonce} to generate the PoP token.\n */\n resourceRequestUrl: string;\n };\n}\n\n/**\n * Represents an access token with an expiration time.\n */\nexport interface AccessToken {\n /**\n * The access token returned by the authentication service.\n */\n token: string;\n\n /**\n * The access token's expiration timestamp in milliseconds, UNIX epoch time.\n */\n expiresOnTimestamp: number;\n\n /**\n * The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.\n */\n refreshAfterTimestamp?: number;\n\n /** Type of token - `Bearer` or `pop` */\n tokenType?: \"Bearer\" | \"pop\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is bearer type or not\n */\nexport function isBearerToken(accessToken: AccessToken): boolean {\n return !accessToken.tokenType || accessToken.tokenType === \"Bearer\";\n}\n\n/**\n * @internal\n * @param accessToken - Access token\n * @returns Whether a token is Pop token or not\n */\nexport function isPopToken(accessToken: AccessToken): boolean {\n return accessToken.tokenType === \"pop\";\n}\n\n/**\n * Tests an object to determine whether it implements TokenCredential.\n *\n * @param credential - The assumed TokenCredential to be tested.\n */\nexport function isTokenCredential(credential: unknown): credential is TokenCredential {\n // Check for an object with a 'getToken' function and possibly with\n // a 'signRequest' function. We do this check to make sure that\n // a ServiceClientCredentials implementor (like TokenClientCredentials\n // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if\n // it doesn't actually implement TokenCredential also.\n const castCredential = credential as {\n getToken: unknown;\n signRequest: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.getToken === \"function\" &&\n (castCredential.signRequest === undefined || castCredential.getToken.length > 0)\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/core-auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Provides low-level interfaces and helper methods for authentication in Azure SDK",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"type": "module",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@azure/abort-controller": "^2.0.0",
|
|
78
|
-
"@azure/core-util": "^1.
|
|
78
|
+
"@azure/core-util": "^1.11.0",
|
|
79
79
|
"tslib": "^2.6.2"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@azure/dev-tool": "
|
|
83
|
-
"@azure/eslint-plugin-azure-sdk": "
|
|
82
|
+
"@azure/dev-tool": "^1.0.0",
|
|
83
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
84
84
|
"@microsoft/api-extractor": "^7.40.3",
|
|
85
85
|
"@types/node": "^18.0.0",
|
|
86
86
|
"@vitest/browser": "^2.0.5",
|