@azure/msal-node 1.9.1 → 1.12.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/README.md +1 -3
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts +9 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/IConfidentialClientApplication.d.ts +3 -1
- package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
- package/dist/config/Configuration.d.ts +2 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +45 -10
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +45 -10
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/request/ClientCredentialRequest.d.ts +3 -1
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/RefreshTokenRequest.d.ts +3 -1
- package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/msal-node.esm.js
CHANGED
|
@@ -357,7 +357,8 @@ const DEFAULT_AUTH_OPTIONS = {
|
|
|
357
357
|
azureCloudOptions: {
|
|
358
358
|
azureCloudInstance: AzureCloudInstance.None,
|
|
359
359
|
tenant: Constants$1.EMPTY_STRING
|
|
360
|
-
}
|
|
360
|
+
},
|
|
361
|
+
skipAuthorityMetadataCache: false
|
|
361
362
|
};
|
|
362
363
|
const DEFAULT_CACHE_OPTIONS = {};
|
|
363
364
|
const DEFAULT_LOGGER_OPTIONS = {
|
|
@@ -1752,7 +1753,7 @@ class TokenCache {
|
|
|
1752
1753
|
|
|
1753
1754
|
/* eslint-disable header/header */
|
|
1754
1755
|
const name = "@azure/msal-node";
|
|
1755
|
-
const version = "1.
|
|
1756
|
+
const version = "1.12.0";
|
|
1756
1757
|
|
|
1757
1758
|
/*
|
|
1758
1759
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1965,7 +1966,7 @@ class ClientApplication {
|
|
|
1965
1966
|
this.logger.verbose(`building oauth client configuration with the authority: ${authority}`, requestCorrelationId);
|
|
1966
1967
|
const discoveredAuthority = await this.createAuthority(authority, azureRegionConfiguration, requestCorrelationId, userAzureCloudOptions);
|
|
1967
1968
|
serverTelemetryManager == null ? void 0 : serverTelemetryManager.updateRegionDiscoveryMetadata(discoveredAuthority.regionDiscoveryMetadata);
|
|
1968
|
-
|
|
1969
|
+
const clientConfiguration = {
|
|
1969
1970
|
authOptions: {
|
|
1970
1971
|
clientId: this.config.auth.clientId,
|
|
1971
1972
|
authority: discoveredAuthority,
|
|
@@ -1998,6 +1999,7 @@ class ClientApplication {
|
|
|
1998
1999
|
persistencePlugin: this.config.cache.cachePlugin,
|
|
1999
2000
|
serializableCache: this.tokenCache
|
|
2000
2001
|
};
|
|
2002
|
+
return clientConfiguration;
|
|
2001
2003
|
}
|
|
2002
2004
|
|
|
2003
2005
|
getClientAssertion(authority) {
|
|
@@ -2064,7 +2066,8 @@ class ClientApplication {
|
|
|
2064
2066
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
2065
2067
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
2066
2068
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
2067
|
-
azureRegionConfiguration
|
|
2069
|
+
azureRegionConfiguration,
|
|
2070
|
+
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache
|
|
2068
2071
|
};
|
|
2069
2072
|
return await AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.config.system.proxyUrl);
|
|
2070
2073
|
}
|
|
@@ -2313,6 +2316,18 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2313
2316
|
constructor(configuration) {
|
|
2314
2317
|
super(configuration);
|
|
2315
2318
|
this.setClientCredential(this.config);
|
|
2319
|
+
this.appTokenProvider = undefined;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
|
|
2323
|
+
* is meant for Azure SDK to enhance Managed Identity support.
|
|
2324
|
+
*
|
|
2325
|
+
* @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
|
|
2326
|
+
*/
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
SetAppTokenProvider(provider) {
|
|
2330
|
+
this.appTokenProvider = provider;
|
|
2316
2331
|
}
|
|
2317
2332
|
/**
|
|
2318
2333
|
* Acquires tokens from the authority for the application (not for an end user).
|
|
@@ -2320,9 +2335,20 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2320
2335
|
|
|
2321
2336
|
|
|
2322
2337
|
async acquireTokenByClientCredential(request) {
|
|
2323
|
-
this.logger.info("acquireTokenByClientCredential called", request.correlationId);
|
|
2338
|
+
this.logger.info("acquireTokenByClientCredential called", request.correlationId); // If there is a client assertion present in the request, it overrides the one present in the client configuration
|
|
2339
|
+
|
|
2340
|
+
let clientAssertion;
|
|
2341
|
+
|
|
2342
|
+
if (request.clientAssertion) {
|
|
2343
|
+
clientAssertion = {
|
|
2344
|
+
assertion: request.clientAssertion,
|
|
2345
|
+
assertionType: Constants.JWT_BEARER_ASSERTION_TYPE
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2324
2349
|
const validRequest = { ...request,
|
|
2325
|
-
...(await this.initializeBaseRequest(request))
|
|
2350
|
+
...(await this.initializeBaseRequest(request)),
|
|
2351
|
+
clientAssertion
|
|
2326
2352
|
};
|
|
2327
2353
|
const azureRegionConfiguration = {
|
|
2328
2354
|
azureRegion: validRequest.azureRegion,
|
|
@@ -2332,7 +2358,7 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2332
2358
|
|
|
2333
2359
|
try {
|
|
2334
2360
|
const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
|
|
2335
|
-
const clientCredentialClient = new ClientCredentialClient(clientCredentialConfig);
|
|
2361
|
+
const clientCredentialClient = new ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
|
|
2336
2362
|
this.logger.verbose("Client credential client created", validRequest.correlationId);
|
|
2337
2363
|
return clientCredentialClient.acquireToken(validRequest);
|
|
2338
2364
|
} catch (e) {
|
|
@@ -2364,8 +2390,8 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2364
2390
|
};
|
|
2365
2391
|
|
|
2366
2392
|
try {
|
|
2367
|
-
const
|
|
2368
|
-
const oboClient = new OnBehalfOfClient(
|
|
2393
|
+
const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
|
|
2394
|
+
const oboClient = new OnBehalfOfClient(onBehalfOfConfig);
|
|
2369
2395
|
this.logger.verbose("On behalf of client created", validRequest.correlationId);
|
|
2370
2396
|
return oboClient.acquireToken(validRequest);
|
|
2371
2397
|
} catch (e) {
|
|
@@ -2384,7 +2410,16 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2384
2410
|
thumbprint: Constants$1.EMPTY_STRING,
|
|
2385
2411
|
privateKey: Constants$1.EMPTY_STRING
|
|
2386
2412
|
};
|
|
2387
|
-
const certificateNotEmpty = !StringUtils.isEmpty(certificate.thumbprint) || !StringUtils.isEmpty(certificate.privateKey);
|
|
2413
|
+
const certificateNotEmpty = !StringUtils.isEmpty(certificate.thumbprint) || !StringUtils.isEmpty(certificate.privateKey);
|
|
2414
|
+
/*
|
|
2415
|
+
* If app developer configures this callback, they don't need a credential
|
|
2416
|
+
* i.e. AzureSDK can get token from Managed Identity without a cert / secret
|
|
2417
|
+
*/
|
|
2418
|
+
|
|
2419
|
+
if (this.appTokenProvider) {
|
|
2420
|
+
return;
|
|
2421
|
+
} // Check that at most one credential is set on the application
|
|
2422
|
+
|
|
2388
2423
|
|
|
2389
2424
|
if (clientSecretNotEmpty && clientAssertionNotEmpty || clientAssertionNotEmpty && certificateNotEmpty || clientSecretNotEmpty && certificateNotEmpty) {
|
|
2390
2425
|
throw ClientAuthError.createInvalidCredentialError();
|