@azure/msal-node 1.0.0-beta.1 → 1.0.0-beta.2
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/CHANGELOG.json +39 -0
- package/changelog.md +27 -15
- package/dist/cache/Storage.d.ts +2 -2
- package/dist/client/ClientApplication.d.ts +10 -6
- package/dist/client/ConfidentialClientApplication.d.ts +5 -3
- package/dist/client/PublicClientApplication.d.ts +5 -3
- package/dist/index.d.ts +8 -1
- package/dist/msal-node.cjs.development.js +59 -46
- 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 +60 -47
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +17 -0
- package/dist/request/AuthorizationUrlRequest.d.ts +30 -0
- package/dist/request/ClientCredentialRequest.d.ts +11 -0
- package/dist/request/DeviceCodeRequest.d.ts +13 -0
- package/dist/request/OnBehalfOfRequest.d.ts +12 -0
- package/dist/request/RefreshTokenRequest.d.ts +13 -0
- package/dist/request/SilentFlowRequest.d.ts +14 -0
- package/dist/request/UsernamePasswordRequest.d.ts +17 -0
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/msal-node",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Mon, 07 Dec 2020 22:19:03 GMT",
|
|
6
|
+
"tag": "@azure/msal-node_v1.0.0-beta.2",
|
|
7
|
+
"version": "1.0.0-beta.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Expose idTokenClaims on AccountInfo (#2554)",
|
|
12
|
+
"author": "janutter@microsoft.com",
|
|
13
|
+
"commit": "cb2165aad7995d904ec49ade565d907dc314ce16",
|
|
14
|
+
"package": "@azure/msal-node"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Add null to API response signatures (#2602)",
|
|
18
|
+
"author": "thomas.norling@microsoft.com",
|
|
19
|
+
"commit": "ebf18c6daead16f8cfd2afb3b63cbd59fc63046a",
|
|
20
|
+
"package": "@azure/msal-node"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"comment": "Enforce triple equals in eslint",
|
|
24
|
+
"author": "janutter@microsoft.com",
|
|
25
|
+
"commit": "5975eb4077a2b4372683e68af4d748b0808134ab",
|
|
26
|
+
"package": "@azure/msal-node"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"comment": "Log messages contain package name and version (#2589)",
|
|
30
|
+
"author": "thomas.norling@microsoft.com",
|
|
31
|
+
"commit": "4568c16bd425e242cdb799ec59b3508654cc2e45",
|
|
32
|
+
"package": "@azure/msal-node"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"comment": "Update request types (#2512)",
|
|
36
|
+
"author": "thomas.norling@microsoft.com",
|
|
37
|
+
"commit": "5b891222d674eb5664af9187f319a61b50341f55",
|
|
38
|
+
"package": "@azure/msal-node"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
4
43
|
{
|
|
5
44
|
"date": "Wed, 11 Nov 2020 23:33:20 GMT",
|
|
6
45
|
"tag": "@azure/msal-node_v1.0.0-beta.1",
|
package/changelog.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
# Change Log - @azure/msal-node
|
|
2
|
-
|
|
3
|
-
This log was last generated on
|
|
4
|
-
|
|
5
|
-
<!-- Start content -->
|
|
6
|
-
|
|
7
|
-
## 1.0.0-beta.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Changes
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
1
|
+
# Change Log - @azure/msal-node
|
|
2
|
+
|
|
3
|
+
This log was last generated on Mon, 07 Dec 2020 22:19:03 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 1.0.0-beta.2
|
|
8
|
+
|
|
9
|
+
Mon, 07 Dec 2020 22:19:03 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Expose idTokenClaims on AccountInfo (#2554) (janutter@microsoft.com)
|
|
14
|
+
- Add null to API response signatures (#2602) (thomas.norling@microsoft.com)
|
|
15
|
+
- Enforce triple equals in eslint (janutter@microsoft.com)
|
|
16
|
+
- Log messages contain package name and version (#2589) (thomas.norling@microsoft.com)
|
|
17
|
+
- Update request types (#2512) (thomas.norling@microsoft.com)
|
|
18
|
+
|
|
19
|
+
## 1.0.0-beta.1
|
|
20
|
+
|
|
21
|
+
Wed, 11 Nov 2020 23:33:20 GMT
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
|
|
25
|
+
- Add support for SubjectName/Issuer authentication (#2471). (jamckenn@microsoft.com)
|
|
26
|
+
|
|
15
27
|
## 1.0.0-alpha.16
|
|
16
28
|
|
|
17
29
|
Tue, 10 Nov 2020 01:48:44 GMT
|
|
@@ -155,4 +167,4 @@ Tue, 25 Aug 2020 00:40:45 GMT
|
|
|
155
167
|
- Update UnifiedCacheManager.ts (#1771)
|
|
156
168
|
- Node cache interface (#1801)
|
|
157
169
|
- SilentFlow node interface (#1809)
|
|
158
|
-
- Update TokenCache name (#1901)
|
|
170
|
+
- Update TokenCache name (#1901)
|
package/dist/cache/Storage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType } from "@azure/msal-common";
|
|
1
|
+
import { AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto } from "@azure/msal-common";
|
|
2
2
|
import { InMemoryCache, JsonCache, CacheKVStore } from "./serializer/SerializerTypes";
|
|
3
3
|
/**
|
|
4
4
|
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
|
@@ -7,7 +7,7 @@ export declare class Storage extends CacheManager {
|
|
|
7
7
|
private logger;
|
|
8
8
|
private cache;
|
|
9
9
|
private changeEmitters;
|
|
10
|
-
constructor(logger: Logger);
|
|
10
|
+
constructor(logger: Logger, clientId: string, cryptoImpl: ICrypto);
|
|
11
11
|
registerChangeEmitter(func: () => void): void;
|
|
12
12
|
emitChange(): void;
|
|
13
13
|
/**
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientConfiguration, AuthenticationResult, BaseAuthRequest, Logger, ServerTelemetryManager } from "@azure/msal-common";
|
|
2
2
|
import { Configuration } from "../config/Configuration";
|
|
3
3
|
import { Storage } from "../cache/Storage";
|
|
4
4
|
import { TokenCache } from "../cache/TokenCache";
|
|
5
5
|
import { ClientAssertion } from "./ClientAssertion";
|
|
6
|
+
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
|
|
7
|
+
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
|
|
8
|
+
import { RefreshTokenRequest } from "../request/RefreshTokenRequest";
|
|
9
|
+
import { SilentFlowRequest } from "../request/SilentFlowRequest";
|
|
6
10
|
export declare abstract class ClientApplication {
|
|
7
11
|
private _authority;
|
|
8
12
|
private readonly cryptoProvider;
|
|
@@ -34,7 +38,7 @@ export declare abstract class ClientApplication {
|
|
|
34
38
|
* Authorization Code flow. Ensure that values for redirectUri and scopes in AuthorizationCodeUrlRequest and
|
|
35
39
|
* AuthorizationCodeRequest are the same.
|
|
36
40
|
*/
|
|
37
|
-
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
|
|
41
|
+
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult | null>;
|
|
38
42
|
/**
|
|
39
43
|
* Acquires a token by exchanging the refresh token provided for a new set of tokens.
|
|
40
44
|
*
|
|
@@ -42,7 +46,7 @@ export declare abstract class ClientApplication {
|
|
|
42
46
|
* recommended that you use `acquireTokenSilent()` for silent scenarios. When using `acquireTokenSilent()`, MSAL will
|
|
43
47
|
* handle the caching and refreshing of tokens automatically.
|
|
44
48
|
*/
|
|
45
|
-
acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult>;
|
|
49
|
+
acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>;
|
|
46
50
|
/**
|
|
47
51
|
* Acquires a token silently when a user specifies the account the token is requested for.
|
|
48
52
|
*
|
|
@@ -51,7 +55,7 @@ export declare abstract class ClientApplication {
|
|
|
51
55
|
* In case the refresh_token is expired or not found, an error is thrown
|
|
52
56
|
* and the guidance is for the user to call any interactive token acquisition API (eg: `acquireTokenByCode()`).
|
|
53
57
|
*/
|
|
54
|
-
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult>;
|
|
58
|
+
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
|
|
55
59
|
/**
|
|
56
60
|
* Gets the token cache for the application.
|
|
57
61
|
*/
|
|
@@ -65,13 +69,13 @@ export declare abstract class ClientApplication {
|
|
|
65
69
|
* @param logger Logger instance
|
|
66
70
|
*/
|
|
67
71
|
setLogger(logger: Logger): void;
|
|
68
|
-
protected buildOauthClientConfiguration(authority
|
|
72
|
+
protected buildOauthClientConfiguration(authority: string, serverTelemetryManager?: ServerTelemetryManager): Promise<ClientConfiguration>;
|
|
69
73
|
private getClientAssertion;
|
|
70
74
|
/**
|
|
71
75
|
* Generates a request with the default scopes & generates a correlationId.
|
|
72
76
|
* @param authRequest
|
|
73
77
|
*/
|
|
74
|
-
protected
|
|
78
|
+
protected initializeBaseRequest(authRequest: Partial<BaseAuthRequest>): BaseAuthRequest;
|
|
75
79
|
protected initializeServerTelemetryManager(apiId: number, correlationId: string, forceRefresh?: boolean): ServerTelemetryManager;
|
|
76
80
|
/**
|
|
77
81
|
* Create authority instance. If authority not passed in request, default to authority set on the application
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ClientApplication } from "./ClientApplication";
|
|
2
2
|
import { Configuration } from "../config/Configuration";
|
|
3
|
-
import {
|
|
3
|
+
import { AuthenticationResult } from "@azure/msal-common";
|
|
4
|
+
import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest";
|
|
5
|
+
import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
|
|
4
6
|
export declare class ConfidentialClientApplication extends ClientApplication {
|
|
5
7
|
/**
|
|
6
8
|
* @constructor
|
|
@@ -26,7 +28,7 @@ export declare class ConfidentialClientApplication extends ClientApplication {
|
|
|
26
28
|
/**
|
|
27
29
|
* Acquires tokens from the authority for the application (not for an end user).
|
|
28
30
|
*/
|
|
29
|
-
acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult>;
|
|
31
|
+
acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult | null>;
|
|
30
32
|
/**
|
|
31
33
|
* Acquires tokens from the authority for the application.
|
|
32
34
|
*
|
|
@@ -38,6 +40,6 @@ export declare class ConfidentialClientApplication extends ClientApplication {
|
|
|
38
40
|
* See how to gain consent upfront for your middle-tier app from this article.
|
|
39
41
|
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
|
|
40
42
|
*/
|
|
41
|
-
acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult>;
|
|
43
|
+
acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult | null>;
|
|
42
44
|
private setClientCredential;
|
|
43
45
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthenticationResult } from "@azure/msal-common";
|
|
2
2
|
import { Configuration } from "../config/Configuration";
|
|
3
3
|
import { ClientApplication } from "./ClientApplication";
|
|
4
|
+
import { DeviceCodeRequest } from "../request/DeviceCodeRequest";
|
|
5
|
+
import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest";
|
|
4
6
|
/**
|
|
5
7
|
* This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
|
|
6
8
|
* are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
|
|
@@ -33,7 +35,7 @@ export declare class PublicClientApplication extends ClientApplication {
|
|
|
33
35
|
* Since the client cannot receive incoming requests, it polls the authorization server repeatedly
|
|
34
36
|
* until the end-user completes input of credentials.
|
|
35
37
|
*/
|
|
36
|
-
acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult>;
|
|
38
|
+
acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult | null>;
|
|
37
39
|
/**
|
|
38
40
|
* Acquires tokens with password grant by exchanging client applications username and password for credentials
|
|
39
41
|
*
|
|
@@ -44,5 +46,5 @@ export declare class PublicClientApplication extends ClientApplication {
|
|
|
44
46
|
*
|
|
45
47
|
* @param request
|
|
46
48
|
*/
|
|
47
|
-
acquireTokenByUsernamePassword(request: UsernamePasswordRequest): Promise<AuthenticationResult>;
|
|
49
|
+
acquireTokenByUsernamePassword(request: UsernamePasswordRequest): Promise<AuthenticationResult | null>;
|
|
48
50
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,11 @@ export { Serializer } from "./cache/serializer/Serializer";
|
|
|
6
6
|
export { Deserializer } from "./cache/serializer/Deserializer";
|
|
7
7
|
export { TokenCache } from "./cache/TokenCache";
|
|
8
8
|
export { CryptoProvider } from "./crypto/CryptoProvider";
|
|
9
|
-
export { AuthorizationCodeRequest
|
|
9
|
+
export type { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
|
|
10
|
+
export type { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
|
|
11
|
+
export type { ClientCredentialRequest } from "./request/ClientCredentialRequest";
|
|
12
|
+
export type { DeviceCodeRequest } from "./request/DeviceCodeRequest";
|
|
13
|
+
export type { OnBehalfOfRequest } from "./request/OnBehalfOfRequest";
|
|
14
|
+
export type { RefreshTokenRequest } from "./request/RefreshTokenRequest";
|
|
15
|
+
export type { SilentFlowRequest } from "./request/SilentFlowRequest";
|
|
16
|
+
export { PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, InteractionRequiredAuthError, ServerError, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache } from "@azure/msal-common";
|
|
@@ -1046,7 +1046,7 @@ var NetworkUtils = /*#__PURE__*/function () {
|
|
|
1046
1046
|
|
|
1047
1047
|
var DEFAULT_AUTH_OPTIONS = {
|
|
1048
1048
|
clientId: "",
|
|
1049
|
-
authority:
|
|
1049
|
+
authority: msalCommon.Constants.DEFAULT_AUTHORITY,
|
|
1050
1050
|
clientSecret: "",
|
|
1051
1051
|
clientAssertion: "",
|
|
1052
1052
|
clientCertificate: {
|
|
@@ -1671,10 +1671,10 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
1671
1671
|
var Storage = /*#__PURE__*/function (_CacheManager) {
|
|
1672
1672
|
_inheritsLoose(Storage, _CacheManager);
|
|
1673
1673
|
|
|
1674
|
-
function Storage(logger) {
|
|
1674
|
+
function Storage(logger, clientId, cryptoImpl) {
|
|
1675
1675
|
var _this;
|
|
1676
1676
|
|
|
1677
|
-
_this = _CacheManager.call(this) || this;
|
|
1677
|
+
_this = _CacheManager.call(this, clientId, cryptoImpl) || this;
|
|
1678
1678
|
_this.cache = {};
|
|
1679
1679
|
_this.changeEmitters = [];
|
|
1680
1680
|
_this.logger = logger;
|
|
@@ -2415,11 +2415,11 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2415
2415
|
|
|
2416
2416
|
_proto.mergeRemovals = function mergeRemovals(oldState, newState) {
|
|
2417
2417
|
this.logger.verbose("Remove updated entries in cache");
|
|
2418
|
-
var accounts = oldState.Account
|
|
2419
|
-
var accessTokens = oldState.AccessToken
|
|
2420
|
-
var refreshTokens = oldState.RefreshToken
|
|
2421
|
-
var idTokens = oldState.IdToken
|
|
2422
|
-
var appMetadata = oldState.AppMetadata
|
|
2418
|
+
var accounts = oldState.Account ? this.mergeRemovalsDict(oldState.Account, newState.Account) : oldState.Account;
|
|
2419
|
+
var accessTokens = oldState.AccessToken ? this.mergeRemovalsDict(oldState.AccessToken, newState.AccessToken) : oldState.AccessToken;
|
|
2420
|
+
var refreshTokens = oldState.RefreshToken ? this.mergeRemovalsDict(oldState.RefreshToken, newState.RefreshToken) : oldState.RefreshToken;
|
|
2421
|
+
var idTokens = oldState.IdToken ? this.mergeRemovalsDict(oldState.IdToken, newState.IdToken) : oldState.IdToken;
|
|
2422
|
+
var appMetadata = oldState.AppMetadata ? this.mergeRemovalsDict(oldState.AppMetadata, newState.AppMetadata) : oldState.AppMetadata;
|
|
2423
2423
|
return _extends({}, oldState, {
|
|
2424
2424
|
Account: accounts,
|
|
2425
2425
|
AccessToken: accessTokens,
|
|
@@ -2454,7 +2454,8 @@ var TokenCache = /*#__PURE__*/function () {
|
|
|
2454
2454
|
return TokenCache;
|
|
2455
2455
|
}();
|
|
2456
2456
|
|
|
2457
|
-
var
|
|
2457
|
+
var name = "@azure/msal-node";
|
|
2458
|
+
var version = "1.0.0-beta.2";
|
|
2458
2459
|
|
|
2459
2460
|
var ClientApplication = /*#__PURE__*/function () {
|
|
2460
2461
|
/**
|
|
@@ -2462,10 +2463,10 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2462
2463
|
*/
|
|
2463
2464
|
function ClientApplication(configuration) {
|
|
2464
2465
|
this.config = buildAppConfiguration(configuration);
|
|
2465
|
-
this.logger = new msalCommon.Logger(this.config.system.loggerOptions);
|
|
2466
|
-
this.storage = new Storage(this.logger);
|
|
2467
|
-
this.tokenCache = new TokenCache(this.storage, this.logger, this.config.cache.cachePlugin);
|
|
2468
2466
|
this.cryptoProvider = new CryptoProvider();
|
|
2467
|
+
this.logger = new msalCommon.Logger(this.config.system.loggerOptions, name, version);
|
|
2468
|
+
this.storage = new Storage(this.logger, this.config.auth.clientId, this.cryptoProvider);
|
|
2469
|
+
this.tokenCache = new TokenCache(this.storage, this.logger, this.config.cache.cachePlugin);
|
|
2469
2470
|
msalCommon.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities, this.config.auth.cloudDiscoveryMetadata);
|
|
2470
2471
|
}
|
|
2471
2472
|
/**
|
|
@@ -2485,22 +2486,26 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2485
2486
|
/*#__PURE__*/
|
|
2486
2487
|
function () {
|
|
2487
2488
|
var _getAuthCodeUrl = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(request) {
|
|
2488
|
-
var authClientConfig, authorizationCodeClient;
|
|
2489
|
+
var validRequest, authClientConfig, authorizationCodeClient;
|
|
2489
2490
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2490
2491
|
while (1) {
|
|
2491
2492
|
switch (_context.prev = _context.next) {
|
|
2492
2493
|
case 0:
|
|
2493
2494
|
this.logger.info("getAuthCodeUrl called");
|
|
2494
|
-
|
|
2495
|
-
|
|
2495
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request), {
|
|
2496
|
+
responseMode: request.responseMode || msalCommon.ResponseMode.QUERY,
|
|
2497
|
+
authenticationScheme: msalCommon.AuthenticationScheme.BEARER
|
|
2498
|
+
});
|
|
2499
|
+
_context.next = 4;
|
|
2500
|
+
return this.buildOauthClientConfiguration(validRequest.authority);
|
|
2496
2501
|
|
|
2497
|
-
case
|
|
2502
|
+
case 4:
|
|
2498
2503
|
authClientConfig = _context.sent;
|
|
2499
2504
|
this.logger.verbose("Auth client config generated");
|
|
2500
2505
|
authorizationCodeClient = new msalCommon.AuthorizationCodeClient(authClientConfig);
|
|
2501
|
-
return _context.abrupt("return", authorizationCodeClient.getAuthCodeUrl(
|
|
2506
|
+
return _context.abrupt("return", authorizationCodeClient.getAuthCodeUrl(validRequest));
|
|
2502
2507
|
|
|
2503
|
-
case
|
|
2508
|
+
case 8:
|
|
2504
2509
|
case "end":
|
|
2505
2510
|
return _context.stop();
|
|
2506
2511
|
}
|
|
@@ -2534,11 +2539,13 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2534
2539
|
switch (_context2.prev = _context2.next) {
|
|
2535
2540
|
case 0:
|
|
2536
2541
|
this.logger.info("acquireTokenByCode called");
|
|
2537
|
-
validRequest = this.
|
|
2542
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request), {
|
|
2543
|
+
authenticationScheme: msalCommon.AuthenticationScheme.BEARER
|
|
2544
|
+
});
|
|
2538
2545
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByCode, validRequest.correlationId);
|
|
2539
2546
|
_context2.prev = 3;
|
|
2540
2547
|
_context2.next = 6;
|
|
2541
|
-
return this.buildOauthClientConfiguration(
|
|
2548
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
2542
2549
|
|
|
2543
2550
|
case 6:
|
|
2544
2551
|
authClientConfig = _context2.sent;
|
|
@@ -2585,11 +2592,13 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2585
2592
|
switch (_context3.prev = _context3.next) {
|
|
2586
2593
|
case 0:
|
|
2587
2594
|
this.logger.info("acquireTokenByRefreshToken called");
|
|
2588
|
-
validRequest = this.
|
|
2595
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request), {
|
|
2596
|
+
authenticationScheme: msalCommon.AuthenticationScheme.BEARER
|
|
2597
|
+
});
|
|
2589
2598
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByRefreshToken, validRequest.correlationId);
|
|
2590
2599
|
_context3.prev = 3;
|
|
2591
2600
|
_context3.next = 6;
|
|
2592
|
-
return this.buildOauthClientConfiguration(
|
|
2601
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
2593
2602
|
|
|
2594
2603
|
case 6:
|
|
2595
2604
|
refreshTokenClientConfig = _context3.sent;
|
|
@@ -2636,11 +2645,13 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2636
2645
|
while (1) {
|
|
2637
2646
|
switch (_context4.prev = _context4.next) {
|
|
2638
2647
|
case 0:
|
|
2639
|
-
validRequest = this.
|
|
2648
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request), {
|
|
2649
|
+
forceRefresh: request.forceRefresh || false
|
|
2650
|
+
});
|
|
2640
2651
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
|
|
2641
2652
|
_context4.prev = 2;
|
|
2642
2653
|
_context4.next = 5;
|
|
2643
|
-
return this.buildOauthClientConfiguration(
|
|
2654
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
2644
2655
|
|
|
2645
2656
|
case 5:
|
|
2646
2657
|
silentFlowClientConfig = _context4.sent;
|
|
@@ -2780,11 +2791,12 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2780
2791
|
*/
|
|
2781
2792
|
;
|
|
2782
2793
|
|
|
2783
|
-
_proto.
|
|
2794
|
+
_proto.initializeBaseRequest = function initializeBaseRequest(authRequest) {
|
|
2784
2795
|
this.logger.verbose("initializeRequestScopes called");
|
|
2785
2796
|
return _extends({}, authRequest, {
|
|
2786
2797
|
scopes: [].concat(authRequest && authRequest.scopes || [], [msalCommon.Constants.OPENID_SCOPE, msalCommon.Constants.PROFILE_SCOPE, msalCommon.Constants.OFFLINE_ACCESS_SCOPE]),
|
|
2787
|
-
correlationId: authRequest && authRequest.correlationId || this.cryptoProvider.createNewGuid()
|
|
2798
|
+
correlationId: authRequest && authRequest.correlationId || this.cryptoProvider.createNewGuid(),
|
|
2799
|
+
authority: authRequest.authority || this.config.auth.authority
|
|
2788
2800
|
});
|
|
2789
2801
|
};
|
|
2790
2802
|
|
|
@@ -2815,11 +2827,11 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2815
2827
|
case 0:
|
|
2816
2828
|
this.logger.verbose("createAuthority called");
|
|
2817
2829
|
|
|
2818
|
-
if (authorityString) {
|
|
2830
|
+
if (this.authority.canonicalAuthority !== authorityString) {
|
|
2819
2831
|
this.logger.verbose("Authority passed in, creating authority instance");
|
|
2820
2832
|
authority = msalCommon.AuthorityFactory.createInstance(authorityString, this.config.system.networkClient, this.config.auth.protocolMode);
|
|
2821
2833
|
} else {
|
|
2822
|
-
this.logger.verbose("
|
|
2834
|
+
this.logger.verbose("Authority on request is the same as on application object, defaulting to authority set on application object");
|
|
2823
2835
|
authority = this.authority;
|
|
2824
2836
|
}
|
|
2825
2837
|
|
|
@@ -2865,7 +2877,7 @@ var ClientApplication = /*#__PURE__*/function () {
|
|
|
2865
2877
|
return this._authority;
|
|
2866
2878
|
}
|
|
2867
2879
|
|
|
2868
|
-
this._authority = msalCommon.AuthorityFactory.createInstance(this.config.auth.authority
|
|
2880
|
+
this._authority = msalCommon.AuthorityFactory.createInstance(this.config.auth.authority, this.config.system.networkClient, this.config.auth.protocolMode);
|
|
2869
2881
|
return this._authority;
|
|
2870
2882
|
}
|
|
2871
2883
|
}]);
|
|
@@ -2924,11 +2936,11 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
2924
2936
|
switch (_context.prev = _context.next) {
|
|
2925
2937
|
case 0:
|
|
2926
2938
|
this.logger.info("acquireTokenByDeviceCode called");
|
|
2927
|
-
validRequest = this.
|
|
2939
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request));
|
|
2928
2940
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
|
|
2929
2941
|
_context.prev = 3;
|
|
2930
2942
|
_context.next = 6;
|
|
2931
|
-
return this.buildOauthClientConfiguration(
|
|
2943
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
2932
2944
|
|
|
2933
2945
|
case 6:
|
|
2934
2946
|
deviceCodeConfig = _context.sent;
|
|
@@ -2978,11 +2990,11 @@ var PublicClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
2978
2990
|
switch (_context2.prev = _context2.next) {
|
|
2979
2991
|
case 0:
|
|
2980
2992
|
this.logger.info("acquireTokenByUsernamePassword called");
|
|
2981
|
-
validRequest = this.
|
|
2993
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request));
|
|
2982
2994
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByUsernamePassword, validRequest.correlationId);
|
|
2983
2995
|
_context2.prev = 3;
|
|
2984
2996
|
_context2.next = 6;
|
|
2985
|
-
return this.buildOauthClientConfiguration(
|
|
2997
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
2986
2998
|
|
|
2987
2999
|
case 6:
|
|
2988
3000
|
usernamePasswordClientConfig = _context2.sent;
|
|
@@ -3047,8 +3059,8 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3047
3059
|
|
|
3048
3060
|
_proto.getJwt = function getJwt(cryptoProvider, issuer, jwtAudience) {
|
|
3049
3061
|
// if assertion was created from certificate, check if jwt is expired and create new one.
|
|
3050
|
-
if (this.privateKey
|
|
3051
|
-
if (this.jwt
|
|
3062
|
+
if (this.privateKey && this.thumbprint) {
|
|
3063
|
+
if (this.jwt && !this.isExpired() && issuer === this.issuer && jwtAudience === this.jwtAudience) {
|
|
3052
3064
|
return this.jwt;
|
|
3053
3065
|
}
|
|
3054
3066
|
|
|
@@ -3060,7 +3072,7 @@ var ClientAssertion = /*#__PURE__*/function () {
|
|
|
3060
3072
|
*/
|
|
3061
3073
|
|
|
3062
3074
|
|
|
3063
|
-
if (this.jwt
|
|
3075
|
+
if (this.jwt) {
|
|
3064
3076
|
return this.jwt;
|
|
3065
3077
|
}
|
|
3066
3078
|
|
|
@@ -3171,17 +3183,17 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3171
3183
|
switch (_context.prev = _context.next) {
|
|
3172
3184
|
case 0:
|
|
3173
3185
|
this.logger.info("acquireTokenByClientCredential called");
|
|
3174
|
-
validRequest = this.
|
|
3186
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request));
|
|
3175
3187
|
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
|
|
3176
3188
|
_context.prev = 3;
|
|
3177
3189
|
_context.next = 6;
|
|
3178
|
-
return this.buildOauthClientConfiguration(
|
|
3190
|
+
return this.buildOauthClientConfiguration(validRequest.authority, serverTelemetryManager);
|
|
3179
3191
|
|
|
3180
3192
|
case 6:
|
|
3181
3193
|
clientCredentialConfig = _context.sent;
|
|
3182
3194
|
this.logger.verbose("Auth client config generated");
|
|
3183
3195
|
clientCredentialClient = new msalCommon.ClientCredentialClient(clientCredentialConfig);
|
|
3184
|
-
return _context.abrupt("return", clientCredentialClient.acquireToken(
|
|
3196
|
+
return _context.abrupt("return", clientCredentialClient.acquireToken(validRequest));
|
|
3185
3197
|
|
|
3186
3198
|
case 12:
|
|
3187
3199
|
_context.prev = 12;
|
|
@@ -3220,22 +3232,23 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3220
3232
|
/*#__PURE__*/
|
|
3221
3233
|
function () {
|
|
3222
3234
|
var _acquireTokenOnBehalfOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(request) {
|
|
3223
|
-
var clientCredentialConfig, oboClient;
|
|
3235
|
+
var validRequest, clientCredentialConfig, oboClient;
|
|
3224
3236
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3225
3237
|
while (1) {
|
|
3226
3238
|
switch (_context2.prev = _context2.next) {
|
|
3227
3239
|
case 0:
|
|
3228
3240
|
this.logger.info("acquireTokenOnBehalfOf called");
|
|
3229
|
-
|
|
3230
|
-
|
|
3241
|
+
validRequest = _extends({}, request, this.initializeBaseRequest(request));
|
|
3242
|
+
_context2.next = 4;
|
|
3243
|
+
return this.buildOauthClientConfiguration(validRequest.authority);
|
|
3231
3244
|
|
|
3232
|
-
case
|
|
3245
|
+
case 4:
|
|
3233
3246
|
clientCredentialConfig = _context2.sent;
|
|
3234
3247
|
this.logger.verbose("Auth client config generated");
|
|
3235
3248
|
oboClient = new msalCommon.OnBehalfOfClient(clientCredentialConfig);
|
|
3236
|
-
return _context2.abrupt("return", oboClient.acquireToken(
|
|
3249
|
+
return _context2.abrupt("return", oboClient.acquireToken(validRequest));
|
|
3237
3250
|
|
|
3238
|
-
case
|
|
3251
|
+
case 8:
|
|
3239
3252
|
case "end":
|
|
3240
3253
|
return _context2.stop();
|
|
3241
3254
|
}
|
|
@@ -3254,7 +3267,7 @@ var ConfidentialClientApplication = /*#__PURE__*/function (_ClientApplication) {
|
|
|
3254
3267
|
var clientSecretNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientSecret);
|
|
3255
3268
|
var clientAssertionNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientAssertion);
|
|
3256
3269
|
var certificate = configuration.auth.clientCertificate;
|
|
3257
|
-
var certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) || !msalCommon.StringUtils.isEmpty(certificate.privateKey); // Check that at most one credential is set on the application
|
|
3270
|
+
var certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) || !msalCommon.StringUtils.isEmpty(certificate.privateKey); // Check that at most one credential is set on the application
|
|
3258
3271
|
|
|
3259
3272
|
if (clientSecretNotEmpty && clientAssertionNotEmpty || clientAssertionNotEmpty && certificateNotEmpty || clientSecretNotEmpty && certificateNotEmpty) {
|
|
3260
3273
|
throw msalCommon.ClientAuthError.createInvalidCredentialError();
|