@azure/msal-browser 3.3.0 → 3.5.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/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +3 -4
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts.map +1 -1
- package/dist/app/PublicClientNext.mjs +4 -6
- package/dist/app/PublicClientNext.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +26 -26
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +5 -5
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -8
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +21 -38
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +1 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts +4 -4
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +50 -51
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.d.ts +2 -2
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +4 -3
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +0 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -3
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -4
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +1 -12
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +28 -111
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +3 -3
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +59 -50
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -5
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +9 -23
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +1 -6
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -24
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +30 -61
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +30 -15
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +2 -2
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +13 -7
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/response/ResponseHandler.d.ts +8 -0
- package/dist/response/ResponseHandler.d.ts.map +1 -0
- package/dist/response/ResponseHandler.mjs +46 -0
- package/dist/response/ResponseHandler.mjs.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts +7 -14
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +17 -30
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +18434 -61
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +3037 -3733
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -66
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +4 -3
- package/src/app/PublicClientNext.ts +7 -5
- package/src/cache/BrowserCacheManager.ts +29 -50
- package/src/cache/TokenCache.ts +5 -4
- package/src/controllers/ControllerFactory.ts +30 -49
- package/src/controllers/IController.ts +0 -6
- package/src/controllers/StandardController.ts +70 -85
- package/src/crypto/CryptoOps.ts +5 -3
- package/src/index.ts +1 -0
- package/src/interaction_client/BaseInteractionClient.ts +1 -2
- package/src/interaction_client/NativeInteractionClient.ts +4 -3
- package/src/interaction_client/PopupClient.ts +72 -196
- package/src/interaction_client/RedirectClient.ts +111 -100
- package/src/interaction_client/SilentAuthCodeClient.ts +1 -12
- package/src/interaction_client/SilentIframeClient.ts +17 -44
- package/src/interaction_client/SilentRefreshClient.ts +5 -19
- package/src/interaction_client/StandardInteractionClient.ts +2 -48
- package/src/interaction_handler/InteractionHandler.ts +39 -112
- package/src/interaction_handler/RedirectHandler.ts +52 -30
- package/src/interaction_handler/SilentHandler.ts +12 -5
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +73 -0
- package/src/utils/BrowserProtocolUtils.ts +17 -36
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
12
|
},
|
|
13
|
-
"version": "3.
|
|
13
|
+
"version": "3.5.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -100,6 +100,6 @@
|
|
|
100
100
|
"typescript": "^4.9.5"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@azure/msal-common": "14.
|
|
103
|
+
"@azure/msal-common": "14.4.0"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "@azure/msal-common";
|
|
21
21
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
22
22
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
23
|
-
import
|
|
23
|
+
import * as ControllerFactory from "../controllers/ControllerFactory";
|
|
24
24
|
import { StandardController } from "../controllers/StandardController";
|
|
25
25
|
import { BrowserConfiguration, Configuration } from "../config/Configuration";
|
|
26
26
|
import { StandardOperatingContext } from "../operatingcontext/StandardOperatingContext";
|
|
@@ -38,8 +38,9 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
38
38
|
public static async createPublicClientApplication(
|
|
39
39
|
configuration: Configuration
|
|
40
40
|
): Promise<IPublicClientApplication> {
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const controller = await ControllerFactory.createV3Controller(
|
|
42
|
+
configuration
|
|
43
|
+
);
|
|
43
44
|
const pca = new PublicClientApplication(configuration, controller);
|
|
44
45
|
|
|
45
46
|
return pca;
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "@azure/msal-common";
|
|
21
21
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
22
22
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
23
|
-
import
|
|
23
|
+
import * as ControllerFactory from "../controllers/ControllerFactory";
|
|
24
24
|
import { BrowserConfiguration, Configuration } from "../config/Configuration";
|
|
25
25
|
import { EventCallbackFunction } from "../event/EventMessage";
|
|
26
26
|
import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
@@ -47,8 +47,9 @@ export class PublicClientNext implements IPublicClientApplication {
|
|
|
47
47
|
public static async createPublicClientApplication(
|
|
48
48
|
configuration: Configuration
|
|
49
49
|
): Promise<IPublicClientApplication> {
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const controller = await ControllerFactory.createController(
|
|
51
|
+
configuration
|
|
52
|
+
);
|
|
52
53
|
let pca;
|
|
53
54
|
if (controller !== null) {
|
|
54
55
|
pca = new PublicClientNext(configuration, controller);
|
|
@@ -100,8 +101,9 @@ export class PublicClientNext implements IPublicClientApplication {
|
|
|
100
101
|
*/
|
|
101
102
|
async initialize(): Promise<void> {
|
|
102
103
|
if (this.controller instanceof UnknownOperatingContextController) {
|
|
103
|
-
const
|
|
104
|
-
|
|
104
|
+
const result = await ControllerFactory.createController(
|
|
105
|
+
this.configuration
|
|
106
|
+
);
|
|
105
107
|
if (result !== null) {
|
|
106
108
|
this.controller = result;
|
|
107
109
|
}
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
PerformanceEvents,
|
|
37
37
|
IPerformanceClient,
|
|
38
38
|
StaticAuthorityOptions,
|
|
39
|
+
CacheHelpers,
|
|
39
40
|
} from "@azure/msal-common";
|
|
40
41
|
import { CacheOptions } from "../config/Configuration";
|
|
41
42
|
import {
|
|
@@ -52,7 +53,7 @@ import {
|
|
|
52
53
|
import { BrowserStorage } from "./BrowserStorage";
|
|
53
54
|
import { MemoryStorage } from "./MemoryStorage";
|
|
54
55
|
import { IWindowStorage } from "./IWindowStorage";
|
|
55
|
-
import {
|
|
56
|
+
import { extractBrowserRequestState } from "../utils/BrowserProtocolUtils";
|
|
56
57
|
import { NativeTokenRequest } from "../broker/nativeBroker/NativeRequest";
|
|
57
58
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
58
59
|
import { SilentRequest } from "../request/SilentRequest";
|
|
@@ -234,17 +235,15 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
234
235
|
if (credObj && credObj.hasOwnProperty("credentialType")) {
|
|
235
236
|
switch (credObj["credentialType"]) {
|
|
236
237
|
case CredentialType.ID_TOKEN:
|
|
237
|
-
if (
|
|
238
|
+
if (CacheHelpers.isIdTokenEntity(credObj)) {
|
|
238
239
|
this.logger.trace(
|
|
239
240
|
"BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"
|
|
240
241
|
);
|
|
241
242
|
this.logger.tracePii(
|
|
242
243
|
`BrowserCacheManager:createKeyMaps - idToken with key: ${key} found, saving key to token key map`
|
|
243
244
|
);
|
|
244
|
-
const idTokenEntity =
|
|
245
|
-
|
|
246
|
-
credObj
|
|
247
|
-
);
|
|
245
|
+
const idTokenEntity =
|
|
246
|
+
credObj as IdTokenEntity;
|
|
248
247
|
const newKey =
|
|
249
248
|
this.updateCredentialCacheKey(
|
|
250
249
|
key,
|
|
@@ -266,11 +265,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
266
265
|
break;
|
|
267
266
|
case CredentialType.ACCESS_TOKEN:
|
|
268
267
|
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
269
|
-
if (
|
|
270
|
-
AccessTokenEntity.isAccessTokenEntity(
|
|
271
|
-
credObj
|
|
272
|
-
)
|
|
273
|
-
) {
|
|
268
|
+
if (CacheHelpers.isAccessTokenEntity(credObj)) {
|
|
274
269
|
this.logger.trace(
|
|
275
270
|
"BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"
|
|
276
271
|
);
|
|
@@ -278,10 +273,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
278
273
|
`BrowserCacheManager:createKeyMaps - accessToken with key: ${key} found, saving key to token key map`
|
|
279
274
|
);
|
|
280
275
|
const accessTokenEntity =
|
|
281
|
-
|
|
282
|
-
new AccessTokenEntity(),
|
|
283
|
-
credObj
|
|
284
|
-
);
|
|
276
|
+
credObj as AccessTokenEntity;
|
|
285
277
|
const newKey =
|
|
286
278
|
this.updateCredentialCacheKey(
|
|
287
279
|
key,
|
|
@@ -303,9 +295,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
303
295
|
break;
|
|
304
296
|
case CredentialType.REFRESH_TOKEN:
|
|
305
297
|
if (
|
|
306
|
-
|
|
307
|
-
credObj
|
|
308
|
-
)
|
|
298
|
+
CacheHelpers.isRefreshTokenEntity(credObj)
|
|
309
299
|
) {
|
|
310
300
|
this.logger.trace(
|
|
311
301
|
"BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"
|
|
@@ -314,10 +304,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
314
304
|
`BrowserCacheManager:createKeyMaps - refreshToken with key: ${key} found, saving key to token key map`
|
|
315
305
|
);
|
|
316
306
|
const refreshTokenEntity =
|
|
317
|
-
|
|
318
|
-
new RefreshTokenEntity(),
|
|
319
|
-
credObj
|
|
320
|
-
);
|
|
307
|
+
credObj as RefreshTokenEntity;
|
|
321
308
|
const newKey =
|
|
322
309
|
this.updateCredentialCacheKey(
|
|
323
310
|
key,
|
|
@@ -718,7 +705,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
718
705
|
}
|
|
719
706
|
|
|
720
707
|
const parsedIdToken = this.validateAndParseJson(value);
|
|
721
|
-
if (!parsedIdToken || !
|
|
708
|
+
if (!parsedIdToken || !CacheHelpers.isIdTokenEntity(parsedIdToken)) {
|
|
722
709
|
this.logger.trace(
|
|
723
710
|
"BrowserCacheManager.getIdTokenCredential: called, no cache hit"
|
|
724
711
|
);
|
|
@@ -729,7 +716,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
729
716
|
this.logger.trace(
|
|
730
717
|
"BrowserCacheManager.getIdTokenCredential: cache hit"
|
|
731
718
|
);
|
|
732
|
-
return
|
|
719
|
+
return parsedIdToken as IdTokenEntity;
|
|
733
720
|
}
|
|
734
721
|
|
|
735
722
|
/**
|
|
@@ -738,7 +725,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
738
725
|
*/
|
|
739
726
|
setIdTokenCredential(idToken: IdTokenEntity): void {
|
|
740
727
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
741
|
-
const idTokenKey =
|
|
728
|
+
const idTokenKey = CacheHelpers.generateCredentialKey(idToken);
|
|
742
729
|
|
|
743
730
|
this.setItem(idTokenKey, JSON.stringify(idToken));
|
|
744
731
|
|
|
@@ -761,7 +748,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
761
748
|
const parsedAccessToken = this.validateAndParseJson(value);
|
|
762
749
|
if (
|
|
763
750
|
!parsedAccessToken ||
|
|
764
|
-
!
|
|
751
|
+
!CacheHelpers.isAccessTokenEntity(parsedAccessToken)
|
|
765
752
|
) {
|
|
766
753
|
this.logger.trace(
|
|
767
754
|
"BrowserCacheManager.getAccessTokenCredential: called, no cache hit"
|
|
@@ -773,10 +760,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
773
760
|
this.logger.trace(
|
|
774
761
|
"BrowserCacheManager.getAccessTokenCredential: cache hit"
|
|
775
762
|
);
|
|
776
|
-
return
|
|
777
|
-
new AccessTokenEntity(),
|
|
778
|
-
parsedAccessToken
|
|
779
|
-
);
|
|
763
|
+
return parsedAccessToken as AccessTokenEntity;
|
|
780
764
|
}
|
|
781
765
|
|
|
782
766
|
/**
|
|
@@ -787,7 +771,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
787
771
|
this.logger.trace(
|
|
788
772
|
"BrowserCacheManager.setAccessTokenCredential called"
|
|
789
773
|
);
|
|
790
|
-
const accessTokenKey =
|
|
774
|
+
const accessTokenKey = CacheHelpers.generateCredentialKey(accessToken);
|
|
791
775
|
this.setItem(accessTokenKey, JSON.stringify(accessToken));
|
|
792
776
|
|
|
793
777
|
this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
@@ -811,7 +795,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
811
795
|
const parsedRefreshToken = this.validateAndParseJson(value);
|
|
812
796
|
if (
|
|
813
797
|
!parsedRefreshToken ||
|
|
814
|
-
!
|
|
798
|
+
!CacheHelpers.isRefreshTokenEntity(parsedRefreshToken)
|
|
815
799
|
) {
|
|
816
800
|
this.logger.trace(
|
|
817
801
|
"BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"
|
|
@@ -823,10 +807,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
823
807
|
this.logger.trace(
|
|
824
808
|
"BrowserCacheManager.getRefreshTokenCredential: cache hit"
|
|
825
809
|
);
|
|
826
|
-
return
|
|
827
|
-
new RefreshTokenEntity(),
|
|
828
|
-
parsedRefreshToken
|
|
829
|
-
);
|
|
810
|
+
return parsedRefreshToken as RefreshTokenEntity;
|
|
830
811
|
}
|
|
831
812
|
|
|
832
813
|
/**
|
|
@@ -837,7 +818,8 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
837
818
|
this.logger.trace(
|
|
838
819
|
"BrowserCacheManager.setRefreshTokenCredential called"
|
|
839
820
|
);
|
|
840
|
-
const refreshTokenKey =
|
|
821
|
+
const refreshTokenKey =
|
|
822
|
+
CacheHelpers.generateCredentialKey(refreshToken);
|
|
841
823
|
this.setItem(refreshTokenKey, JSON.stringify(refreshToken));
|
|
842
824
|
|
|
843
825
|
this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
@@ -898,12 +880,12 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
898
880
|
);
|
|
899
881
|
return null;
|
|
900
882
|
}
|
|
901
|
-
const
|
|
883
|
+
const parsedEntity = this.validateAndParseJson(value);
|
|
902
884
|
if (
|
|
903
|
-
!
|
|
904
|
-
!
|
|
885
|
+
!parsedEntity ||
|
|
886
|
+
!CacheHelpers.isServerTelemetryEntity(
|
|
905
887
|
serverTelemetryKey,
|
|
906
|
-
|
|
888
|
+
parsedEntity
|
|
907
889
|
)
|
|
908
890
|
) {
|
|
909
891
|
this.logger.trace(
|
|
@@ -913,10 +895,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
913
895
|
}
|
|
914
896
|
|
|
915
897
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit");
|
|
916
|
-
return
|
|
917
|
-
new ServerTelemetryEntity(),
|
|
918
|
-
parsedMetadata
|
|
919
|
-
);
|
|
898
|
+
return parsedEntity as ServerTelemetryEntity;
|
|
920
899
|
}
|
|
921
900
|
|
|
922
901
|
/**
|
|
@@ -1605,7 +1584,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1605
1584
|
return;
|
|
1606
1585
|
}
|
|
1607
1586
|
// Extract state and ensure it matches given InteractionType, then clean request cache
|
|
1608
|
-
const parsedState =
|
|
1587
|
+
const parsedState = extractBrowserRequestState(
|
|
1609
1588
|
this.cryptoImpl,
|
|
1610
1589
|
stateValue
|
|
1611
1590
|
);
|
|
@@ -1804,7 +1783,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1804
1783
|
currentCacheKey: string,
|
|
1805
1784
|
credential: ValidCredentialType
|
|
1806
1785
|
): string {
|
|
1807
|
-
const updatedCacheKey =
|
|
1786
|
+
const updatedCacheKey = CacheHelpers.generateCredentialKey(credential);
|
|
1808
1787
|
|
|
1809
1788
|
if (currentCacheKey !== updatedCacheKey) {
|
|
1810
1789
|
const cacheItem = this.getItem(currentCacheKey);
|
|
@@ -1860,7 +1839,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1860
1839
|
| RedirectRequest
|
|
1861
1840
|
| PopupRequest
|
|
1862
1841
|
): Promise<void> {
|
|
1863
|
-
const idTokenEntity =
|
|
1842
|
+
const idTokenEntity = CacheHelpers.createIdTokenEntity(
|
|
1864
1843
|
result.account?.homeAccountId,
|
|
1865
1844
|
result.account?.environment,
|
|
1866
1845
|
result.idToken,
|
|
@@ -1872,7 +1851,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1872
1851
|
if (request.claims) {
|
|
1873
1852
|
claimsHash = await this.cryptoImpl.hashString(request.claims);
|
|
1874
1853
|
}
|
|
1875
|
-
const accessTokenEntity =
|
|
1854
|
+
const accessTokenEntity = CacheHelpers.createAccessTokenEntity(
|
|
1876
1855
|
result.account?.homeAccountId,
|
|
1877
1856
|
result.account.environment,
|
|
1878
1857
|
result.accessToken,
|
|
@@ -1881,7 +1860,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1881
1860
|
result.scopes.join(" "),
|
|
1882
1861
|
result.expiresOn?.getTime() || 0,
|
|
1883
1862
|
result.extExpiresOn?.getTime() || 0,
|
|
1884
|
-
|
|
1863
|
+
base64Decode,
|
|
1885
1864
|
undefined, // refreshOn
|
|
1886
1865
|
result.tokenType as AuthenticationScheme,
|
|
1887
1866
|
undefined, // userAssertionHash
|
package/src/cache/TokenCache.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
Constants,
|
|
19
19
|
CacheRecord,
|
|
20
20
|
TokenClaims,
|
|
21
|
+
CacheHelpers,
|
|
21
22
|
} from "@azure/msal-common";
|
|
22
23
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
23
24
|
import { SilentRequest } from "../request/SilentRequest";
|
|
@@ -294,7 +295,7 @@ export class TokenCache implements ITokenCache {
|
|
|
294
295
|
environment: string,
|
|
295
296
|
tenantId: string
|
|
296
297
|
): IdTokenEntity {
|
|
297
|
-
const idTokenEntity =
|
|
298
|
+
const idTokenEntity = CacheHelpers.createIdTokenEntity(
|
|
298
299
|
homeAccountId,
|
|
299
300
|
environment,
|
|
300
301
|
idToken,
|
|
@@ -355,7 +356,7 @@ export class TokenCache implements ITokenCache {
|
|
|
355
356
|
response.expires_in + new Date().getTime() / 1000;
|
|
356
357
|
const extendedExpiresOn = options.extendedExpiresOn;
|
|
357
358
|
|
|
358
|
-
const accessTokenEntity =
|
|
359
|
+
const accessTokenEntity = CacheHelpers.createAccessTokenEntity(
|
|
359
360
|
homeAccountId,
|
|
360
361
|
environment,
|
|
361
362
|
response.access_token,
|
|
@@ -364,7 +365,7 @@ export class TokenCache implements ITokenCache {
|
|
|
364
365
|
scopes,
|
|
365
366
|
expiresOn,
|
|
366
367
|
extendedExpiresOn,
|
|
367
|
-
|
|
368
|
+
base64Decode
|
|
368
369
|
);
|
|
369
370
|
|
|
370
371
|
if (this.isBrowserEnvironment) {
|
|
@@ -399,7 +400,7 @@ export class TokenCache implements ITokenCache {
|
|
|
399
400
|
return null;
|
|
400
401
|
}
|
|
401
402
|
|
|
402
|
-
const refreshTokenEntity =
|
|
403
|
+
const refreshTokenEntity = CacheHelpers.createRefreshTokenEntity(
|
|
403
404
|
homeAccountId,
|
|
404
405
|
environment,
|
|
405
406
|
response.refresh_token,
|
|
@@ -6,61 +6,42 @@
|
|
|
6
6
|
import { TeamsAppOperatingContext } from "../operatingcontext/TeamsAppOperatingContext";
|
|
7
7
|
import { StandardOperatingContext } from "../operatingcontext/StandardOperatingContext";
|
|
8
8
|
import { IController } from "./IController";
|
|
9
|
-
import { Logger } from "@azure/msal-common";
|
|
10
9
|
import { Configuration } from "../config/Configuration";
|
|
11
|
-
import { version, name } from "../packageMetadata";
|
|
12
10
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export async function createV3Controller(
|
|
12
|
+
config: Configuration
|
|
13
|
+
): Promise<IController> {
|
|
14
|
+
const standard = new StandardOperatingContext(config);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
this.config = config;
|
|
19
|
-
const loggerOptions = {
|
|
20
|
-
loggerCallback: undefined,
|
|
21
|
-
piiLoggingEnabled: false,
|
|
22
|
-
logLevel: undefined,
|
|
23
|
-
correlationId: undefined,
|
|
24
|
-
};
|
|
25
|
-
this.logger = new Logger(loggerOptions, name, version);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async createV3Controller(): Promise<IController> {
|
|
29
|
-
const standard = new StandardOperatingContext(this.config);
|
|
16
|
+
await standard.initialize();
|
|
30
17
|
|
|
31
|
-
|
|
18
|
+
const controller = await import("./StandardController");
|
|
19
|
+
return await controller.StandardController.createController(standard);
|
|
20
|
+
}
|
|
32
21
|
|
|
22
|
+
export async function createController(
|
|
23
|
+
config: Configuration
|
|
24
|
+
): Promise<IController | null> {
|
|
25
|
+
const standard = new StandardOperatingContext(config);
|
|
26
|
+
const teamsApp = new TeamsAppOperatingContext(config);
|
|
27
|
+
|
|
28
|
+
const operatingContexts = [standard.initialize(), teamsApp.initialize()];
|
|
29
|
+
|
|
30
|
+
await Promise.all(operatingContexts);
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
teamsApp.isAvailable() &&
|
|
34
|
+
teamsApp.getConfig().auth.supportsNestedAppAuth
|
|
35
|
+
) {
|
|
36
|
+
const controller = await import("./NestedAppAuthController");
|
|
37
|
+
return await controller.NestedAppAuthController.createController(
|
|
38
|
+
teamsApp
|
|
39
|
+
);
|
|
40
|
+
} else if (standard.isAvailable()) {
|
|
33
41
|
const controller = await import("./StandardController");
|
|
34
42
|
return await controller.StandardController.createController(standard);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const standard = new StandardOperatingContext(this.config);
|
|
39
|
-
const teamsApp = new TeamsAppOperatingContext(this.config);
|
|
40
|
-
|
|
41
|
-
const operatingContexts = [
|
|
42
|
-
standard.initialize(),
|
|
43
|
-
teamsApp.initialize(),
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
await Promise.all(operatingContexts);
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
teamsApp.isAvailable() &&
|
|
50
|
-
teamsApp.getConfig().auth.supportsNestedAppAuth
|
|
51
|
-
) {
|
|
52
|
-
const controller = await import("./NestedAppAuthController");
|
|
53
|
-
return await controller.NestedAppAuthController.createController(
|
|
54
|
-
teamsApp
|
|
55
|
-
);
|
|
56
|
-
} else if (standard.isAvailable()) {
|
|
57
|
-
const controller = await import("./StandardController");
|
|
58
|
-
return await controller.StandardController.createController(
|
|
59
|
-
standard
|
|
60
|
-
);
|
|
61
|
-
} else {
|
|
62
|
-
// Since neither of the actual operating contexts are available keep the UnknownOperatingContextController
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
43
|
+
} else {
|
|
44
|
+
// Since neither of the actual operating contexts are available keep the UnknownOperatingContextController
|
|
45
|
+
return null;
|
|
65
46
|
}
|
|
66
47
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Logger,
|
|
9
9
|
PerformanceCallbackFunction,
|
|
10
10
|
IPerformanceClient,
|
|
11
|
-
CommonSilentFlowRequest,
|
|
12
11
|
AccountFilter,
|
|
13
12
|
} from "@azure/msal-common";
|
|
14
13
|
import { RedirectRequest } from "../request/RedirectRequest";
|
|
@@ -48,11 +47,6 @@ export interface IController {
|
|
|
48
47
|
accountId?: string
|
|
49
48
|
): Promise<AuthenticationResult>;
|
|
50
49
|
|
|
51
|
-
acquireTokenByRefreshToken(
|
|
52
|
-
commonRequest: CommonSilentFlowRequest,
|
|
53
|
-
silentRequest: SilentRequest
|
|
54
|
-
): Promise<AuthenticationResult>;
|
|
55
|
-
|
|
56
50
|
addEventCallback(callback: EventCallbackFunction): string | null;
|
|
57
51
|
|
|
58
52
|
removeEventCallback(callbackId: string): void;
|