This commit is contained in:
RochesterX
2025-11-12 10:13:24 -05:00
parent d5b0f97adb
commit 6e820464d5
9761 changed files with 706938 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import type { IdentityPlugin } from "./provider.js";
/**
* Extend Azure Identity with additional functionality. Pass a plugin from
* a plugin package, such as:
*
* - `@azure/identity-cache-persistence`: provides persistent token caching
* - `@azure/identity-vscode`: provides the dependencies of
* `VisualStudioCodeCredential` and enables it
*
* Example:
*
* ```ts snippet:consumer_example
* import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
*
* useIdentityPlugin(cachePersistencePlugin);
* // The plugin has the capability to extend `DeviceCodeCredential` and to
* // add middleware to the underlying credentials, such as persistence.
* const credential = new DeviceCodeCredential({
* tokenCachePersistenceOptions: {
* enabled: true,
* },
* });
* ```
*
* @param plugin - the plugin to register
*/
export declare function useIdentityPlugin(plugin: IdentityPlugin): void;
//# sourceMappingURL=consumer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../../../src/plugins/consumer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,eAAe,CAAC;AAkBxE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAE9D"}

View File

@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { msalNodeFlowCacheControl, msalNodeFlowNativeBrokerControl, msalNodeFlowVSCodeCredentialControl, } from "../msal/nodeFlows/msalPlugins.js";
/**
* The context passed to an Identity plugin. This contains objects that
* plugins can use to set backend implementations.
* @internal
*/
const pluginContext = {
cachePluginControl: msalNodeFlowCacheControl,
nativeBrokerPluginControl: msalNodeFlowNativeBrokerControl,
vsCodeCredentialControl: msalNodeFlowVSCodeCredentialControl,
};
/**
* Extend Azure Identity with additional functionality. Pass a plugin from
* a plugin package, such as:
*
* - `@azure/identity-cache-persistence`: provides persistent token caching
* - `@azure/identity-vscode`: provides the dependencies of
* `VisualStudioCodeCredential` and enables it
*
* Example:
*
* ```ts snippet:consumer_example
* import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
*
* useIdentityPlugin(cachePersistencePlugin);
* // The plugin has the capability to extend `DeviceCodeCredential` and to
* // add middleware to the underlying credentials, such as persistence.
* const credential = new DeviceCodeCredential({
* tokenCachePersistenceOptions: {
* enabled: true,
* },
* });
* ```
*
* @param plugin - the plugin to register
*/
export function useIdentityPlugin(plugin) {
plugin(pluginContext);
}
//# sourceMappingURL=consumer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/plugins/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,aAAa,GAAuB;IACxC,kBAAkB,EAAE,wBAAwB;IAC5C,yBAAyB,EAAE,+BAA+B;IAC1D,uBAAuB,EAAE,mCAAmC;CAC7D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAsB;IACtD,MAAM,CAAC,aAAa,CAAC,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AzurePluginContext, IdentityPlugin } from \"./provider.js\";\nimport {\n msalNodeFlowCacheControl,\n msalNodeFlowNativeBrokerControl,\n msalNodeFlowVSCodeCredentialControl,\n} from \"../msal/nodeFlows/msalPlugins.js\";\n\n/**\n * The context passed to an Identity plugin. This contains objects that\n * plugins can use to set backend implementations.\n * @internal\n */\nconst pluginContext: AzurePluginContext = {\n cachePluginControl: msalNodeFlowCacheControl,\n nativeBrokerPluginControl: msalNodeFlowNativeBrokerControl,\n vsCodeCredentialControl: msalNodeFlowVSCodeCredentialControl,\n};\n\n/**\n * Extend Azure Identity with additional functionality. Pass a plugin from\n * a plugin package, such as:\n *\n * - `@azure/identity-cache-persistence`: provides persistent token caching\n * - `@azure/identity-vscode`: provides the dependencies of\n * `VisualStudioCodeCredential` and enables it\n *\n * Example:\n *\n * ```ts snippet:consumer_example\n * import { useIdentityPlugin, DeviceCodeCredential } from \"@azure/identity\";\n *\n * useIdentityPlugin(cachePersistencePlugin);\n * // The plugin has the capability to extend `DeviceCodeCredential` and to\n * // add middleware to the underlying credentials, such as persistence.\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n * ```\n *\n * @param plugin - the plugin to register\n */\nexport function useIdentityPlugin(plugin: IdentityPlugin): void {\n plugin(pluginContext);\n}\n"]}

View File

@@ -0,0 +1,36 @@
import type { TokenCachePersistenceOptions } from "../msal/nodeFlows/tokenCachePersistenceOptions.js";
/**
* The type of an Azure Identity plugin, a function accepting a plugin
* context.
*/
export type IdentityPlugin = (context: unknown) => void;
/**
* Plugin context entries for controlling cache plugins.
*/
export interface CachePluginControl {
setPersistence(persistenceFactory: (options?: TokenCachePersistenceOptions) => Promise<import("@azure/msal-node").ICachePlugin>): void;
}
export interface NativeBrokerPluginControl {
setNativeBroker(nativeBroker: import("@azure/msal-node").INativeBrokerPlugin): void;
}
/**
* Plugin context entries for controlling VisualStudioCodeCredential.
*/
export interface VisualStudioCodeCredentialControl {
setVSCodeAuthRecordPath(path: string): void;
setVSCodeBroker(broker: import("@azure/msal-node").INativeBrokerPlugin): void;
}
/**
* Context options passed to a plugin during initialization.
*
* Plugin authors are responsible for casting their plugin context values
* to this type.
*
* @internal
*/
export interface AzurePluginContext {
cachePluginControl: CachePluginControl;
nativeBrokerPluginControl: NativeBrokerPluginControl;
vsCodeCredentialControl: VisualStudioCodeCredentialControl;
}
//# sourceMappingURL=provider.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/plugins/provider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AAEtG;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CACZ,kBAAkB,EAAE,CAClB,OAAO,CAAC,EAAE,4BAA4B,KAEnC,OAAO,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC,GACpD,IAAI,CAAC;CACT;AAED,MAAM,WAAW,yBAAyB;IAExC,eAAe,CAAC,YAAY,EAAE,OAAO,kBAAkB,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrF;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,eAAe,CAAC,MAAM,EAAE,OAAO,kBAAkB,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC/E;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,uBAAuB,EAAE,iCAAiC,CAAC;CAC5D"}

View File

@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export {};
//# sourceMappingURL=provider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/plugins/provider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions.js\";\n\n/**\n * The type of an Azure Identity plugin, a function accepting a plugin\n * context.\n */\nexport type IdentityPlugin = (context: unknown) => void;\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\nexport interface 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\nexport interface NativeBrokerPluginControl {\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n setNativeBroker(nativeBroker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\nexport interface VisualStudioCodeCredentialControl {\n setVSCodeAuthRecordPath(path: string): void;\n setVSCodeBroker(broker: import(\"@azure/msal-node\").INativeBrokerPlugin): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\nexport interface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n nativeBrokerPluginControl: NativeBrokerPluginControl;\n vsCodeCredentialControl: VisualStudioCodeCredentialControl;\n}\n"]}