@azure/identity-cache-persistence 1.2.1-alpha.20250228.2 → 1.2.1-alpha.20250304.1
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/README.md +3 -3
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -1
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ If this is your first time using `@azure/identity` or Microsoft Entra ID, we rec
|
|
|
31
31
|
|
|
32
32
|
As of `@azure/identity` version 2.0.0, the Identity client library for JavaScript includes a plugin API. This package (`@azure/identity-cache-persistence`) exports a plugin object that you must pass as an argument to the top-level `useIdentityPlugin` function from the `@azure/identity` package. Enable token cache persistence in your program as follows:
|
|
33
33
|
|
|
34
|
-
```ts snippet:
|
|
34
|
+
```ts snippet:ReadmeSampleUsePlugin
|
|
35
35
|
import { useIdentityPlugin } from "@azure/identity";
|
|
36
36
|
import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
37
37
|
|
|
@@ -44,7 +44,7 @@ After calling `useIdentityPlugin`, the persistent token cache plugin is register
|
|
|
44
44
|
|
|
45
45
|
Once the plugin is registered, you can enable token cache persistence by passing `tokenCachePersistenceOptions` with an `enabled` property set to `true` to a credential constructor. In the following example, we use the `DeviceCodeCredential`, since persistent caching of its tokens allows you to skip the interactive device-code authentication flow if a cached token is available.
|
|
46
46
|
|
|
47
|
-
```ts snippet:
|
|
47
|
+
```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
48
48
|
import { DeviceCodeCredential } from "@azure/identity";
|
|
49
49
|
|
|
50
50
|
const credential = new DeviceCodeCredential({
|
|
@@ -66,7 +66,7 @@ console.log((await credential.getToken(scope)).token.substring(0, 10), "...");
|
|
|
66
66
|
|
|
67
67
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
68
68
|
|
|
69
|
-
```ts snippet:
|
|
69
|
+
```ts snippet:SetLogLevel
|
|
70
70
|
import { setLogLevel } from "@azure/logger";
|
|
71
71
|
|
|
72
72
|
setLogLevel("info");
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
11
11
|
*
|
|
12
12
|
* Example:
|
|
13
13
|
*
|
|
14
|
-
* ```ts snippet:
|
|
14
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
15
15
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
16
16
|
*
|
|
17
17
|
* const credential = new DeviceCodeCredential({
|
package/dist/browser/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createPersistenceCachePlugin } from "./provider.js";
|
|
|
13
13
|
*
|
|
14
14
|
* Example:
|
|
15
15
|
*
|
|
16
|
-
* ```ts snippet:
|
|
16
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
17
17
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
18
18
|
*
|
|
19
19
|
* const credential = new DeviceCodeCredential({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleDeviceCodeCredential\n * import { DeviceCodeCredential } from \"@azure/identity\";\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n *\n * // We'll use the Microsoft Graph scope as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substring(0, 10), \"...\");\n * ```\n */\n\nexport const cachePersistencePlugin: IdentityPlugin = (context) => {\n const { cachePluginControl } = context as AzurePluginContext;\n\n cachePluginControl.setPersistence(createPersistenceCachePlugin);\n};\n"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
11
11
|
*
|
|
12
12
|
* Example:
|
|
13
13
|
*
|
|
14
|
-
* ```ts snippet:
|
|
14
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
15
15
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
16
16
|
*
|
|
17
17
|
* const credential = new DeviceCodeCredential({
|
package/dist/commonjs/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const provider_js_1 = require("./provider.js");
|
|
|
16
16
|
*
|
|
17
17
|
* Example:
|
|
18
18
|
*
|
|
19
|
-
* ```ts snippet:
|
|
19
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
20
20
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
21
21
|
*
|
|
22
22
|
* const credential = new DeviceCodeCredential({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,+CAA6D;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEI,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,0CAA4B,CAAC,CAAC;AAClE,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,+CAA6D;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEI,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,0CAA4B,CAAC,CAAC;AAClE,CAAC,CAAC;AAJW,QAAA,sBAAsB,0BAIjC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleDeviceCodeCredential\n * import { DeviceCodeCredential } from \"@azure/identity\";\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n *\n * // We'll use the Microsoft Graph scope as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substring(0, 10), \"...\");\n * ```\n */\n\nexport const cachePersistencePlugin: IdentityPlugin = (context) => {\n const { cachePluginControl } = context as AzurePluginContext;\n\n cachePluginControl.setPersistence(createPersistenceCachePlugin);\n};\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
11
11
|
*
|
|
12
12
|
* Example:
|
|
13
13
|
*
|
|
14
|
-
* ```ts snippet:
|
|
14
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
15
15
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
16
16
|
*
|
|
17
17
|
* const credential = new DeviceCodeCredential({
|
package/dist/esm/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createPersistenceCachePlugin } from "./provider.js";
|
|
|
13
13
|
*
|
|
14
14
|
* Example:
|
|
15
15
|
*
|
|
16
|
-
* ```ts snippet:
|
|
16
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
17
17
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
18
18
|
*
|
|
19
19
|
* const credential = new DeviceCodeCredential({
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleDeviceCodeCredential\n * import { DeviceCodeCredential } from \"@azure/identity\";\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n *\n * // We'll use the Microsoft Graph scope as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substring(0, 10), \"...\");\n * ```\n */\n\nexport const cachePersistencePlugin: IdentityPlugin = (context) => {\n const { cachePluginControl } = context as AzurePluginContext;\n\n cachePluginControl.setPersistence(createPersistenceCachePlugin);\n};\n"]}
|
|
@@ -11,7 +11,7 @@ import type { IdentityPlugin } from "@azure/identity";
|
|
|
11
11
|
*
|
|
12
12
|
* Example:
|
|
13
13
|
*
|
|
14
|
-
* ```ts snippet:
|
|
14
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
15
15
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
16
16
|
*
|
|
17
17
|
* const credential = new DeviceCodeCredential({
|
|
@@ -13,7 +13,7 @@ import { createPersistenceCachePlugin } from "./provider.js";
|
|
|
13
13
|
*
|
|
14
14
|
* Example:
|
|
15
15
|
*
|
|
16
|
-
* ```ts snippet:
|
|
16
|
+
* ```ts snippet:ReadmeSampleDeviceCodeCredential
|
|
17
17
|
* import { DeviceCodeCredential } from "@azure/identity";
|
|
18
18
|
*
|
|
19
19
|
* const credential = new DeviceCodeCredential({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAuB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAmB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAA6B,CAAC;IAE7D,kBAAkB,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { IdentityPlugin, TokenCachePersistenceOptions } from \"@azure/identity\";\nimport { createPersistenceCachePlugin } from \"./provider.js\";\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\ninterface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions,\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n ) => Promise<import(\"@azure/msal-node\").ICachePlugin>,\n ): void;\n}\n/**\n * Context options passed to a plugin during initialization.\n *\n * Represents a subset of the context defined in `@azure/identity`\n *\n */\ninterface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n}\n\n/**\n * A plugin that provides persistent token caching for `@azure/identity`\n * credentials. The plugin API is compatible with `@azure/identity` versions\n * 2.0.0 and later. Load this plugin using the `useIdentityPlugin`\n * function, imported from `@azure/identity`.\n *\n * In order to enable this functionality, you must also pass\n * `tokenCachePersistenceOptions` to your credential constructors with an\n * `enabled` property set to true.\n *\n * Example:\n *\n * ```ts snippet:ReadmeSampleDeviceCodeCredential\n * import { DeviceCodeCredential } from \"@azure/identity\";\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n *\n * // We'll use the Microsoft Graph scope as an example\n * const scope = \"https://graph.microsoft.com/.default\";\n *\n * // Print out part of the access token\n * console.log((await credential.getToken(scope)).token.substring(0, 10), \"...\");\n * ```\n */\n\nexport const cachePersistencePlugin: IdentityPlugin = (context) => {\n const { cachePluginControl } = context as AzurePluginContext;\n\n cachePluginControl.setPersistence(createPersistenceCachePlugin);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/identity-cache-persistence",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.20250304.1",
|
|
4
4
|
"sdk-type": "client",
|
|
5
5
|
"description": "A secure, persistent token cache for Azure Identity credentials that uses the OS secret-management API",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
28
28
|
"unit-test:browser": "echo skipped",
|
|
29
29
|
"unit-test:node": "echo skipped",
|
|
30
|
-
"update-snippets": "
|
|
30
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist/",
|
|
@@ -71,16 +71,17 @@
|
|
|
71
71
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
72
72
|
"@azure/logger": "^1.1.4",
|
|
73
73
|
"@types/node": "^18.0.0",
|
|
74
|
-
"@vitest/browser": "^3.0.
|
|
75
|
-
"@vitest/coverage-istanbul": "^3.0.
|
|
74
|
+
"@vitest/browser": "^3.0.6",
|
|
75
|
+
"@vitest/coverage-istanbul": "^3.0.6",
|
|
76
76
|
"dotenv": "^16.0.0",
|
|
77
77
|
"eslint": "^9.9.0",
|
|
78
|
-
"playwright": "^1.
|
|
78
|
+
"playwright": "^1.50.1",
|
|
79
79
|
"typescript": "~5.7.2",
|
|
80
|
-
"vitest": "^3.0.
|
|
80
|
+
"vitest": "^3.0.6"
|
|
81
81
|
},
|
|
82
82
|
"type": "module",
|
|
83
83
|
"tshy": {
|
|
84
|
+
"project": "./tsconfig.src.json",
|
|
84
85
|
"exports": {
|
|
85
86
|
"./package.json": "./package.json",
|
|
86
87
|
".": "./src/index.ts"
|
|
@@ -93,8 +94,7 @@
|
|
|
93
94
|
"browser",
|
|
94
95
|
"react-native"
|
|
95
96
|
],
|
|
96
|
-
"selfLink": false
|
|
97
|
-
"project": "./tsconfig.src.json"
|
|
97
|
+
"selfLink": false
|
|
98
98
|
},
|
|
99
99
|
"browser": "./dist/browser/index.js",
|
|
100
100
|
"exports": {
|
|
@@ -117,5 +117,6 @@
|
|
|
117
117
|
"default": "./dist/commonjs/index.js"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
}
|
|
120
|
+
},
|
|
121
|
+
"react-native": "./dist/react-native/index.js"
|
|
121
122
|
}
|