@azure/msal-browser 3.0.1 → 3.1.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 +5 -5
- package/dist/app/IPublicClientApplication.d.ts +6 -2
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +4 -1
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +11 -3
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +10 -2
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +5 -4
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +4 -3
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +13 -3
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +54 -26
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +9 -8
- package/dist/cache/DatabaseStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +30 -30
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +3 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +7 -11
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +11 -18
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +7 -26
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +28 -52
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +4 -3
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +0 -3
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +14 -17
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/ModernBrowserCrypto.mjs +1 -1
- package/dist/crypto/ModernBrowserCrypto.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +0 -1
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +8 -8
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
- package/dist/encode/Base64Decode.d.ts +6 -19
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +17 -70
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.d.ts +15 -27
- package/dist/encode/Base64Encode.d.ts.map +1 -1
- package/dist/encode/Base64Encode.mjs +36 -75
- package/dist/encode/Base64Encode.mjs.map +1 -1
- package/dist/error/BrowserAuthError.d.ts +54 -195
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +150 -381
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +45 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/BrowserAuthErrorCodes.mjs +53 -0
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -0
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.mjs +5 -4
- package/dist/error/NativeAuthError.mjs.map +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventHandler.mjs.map +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventMessage.mjs.map +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/event/EventType.mjs.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +4 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +22 -30
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +16 -15
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +7 -6
- 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 +5 -4
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +4 -2
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +10 -8
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +20 -47
- 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 +4 -3
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +8 -7
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +9 -9
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +11 -10
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +10 -9
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs.map +1 -1
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.mjs +9 -8
- package/dist/network/FetchClient.mjs.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/ClearCacheRequest.d.ts +11 -0
- package/dist/request/ClearCacheRequest.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.d.ts +2 -4
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +2 -6
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs.map +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +3 -3
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserStringUtils.mjs +1 -1
- package/dist/utils/BrowserStringUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.d.ts +0 -9
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +8 -33
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +6601 -7104
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +6601 -7104
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +65 -62
- package/package.json +7 -5
- package/src/app/IPublicClientApplication.ts +199 -0
- package/src/app/PublicClientApplication.ts +405 -0
- package/src/broker/nativeBroker/NativeMessageHandler.ts +419 -0
- package/src/broker/nativeBroker/NativeRequest.ts +52 -0
- package/src/broker/nativeBroker/NativeResponse.ts +56 -0
- package/src/cache/AsyncMemoryStorage.ts +158 -0
- package/src/cache/BrowserCacheManager.ts +1994 -0
- package/src/cache/BrowserStorage.ts +54 -0
- package/src/cache/CryptoKeyStore.ts +63 -0
- package/src/cache/DatabaseStorage.ts +287 -0
- package/src/cache/IAsyncMemoryStorage.ts +36 -0
- package/src/cache/ITokenCache.ts +21 -0
- package/src/cache/IWindowStorage.ts +36 -0
- package/src/cache/MemoryStorage.ts +42 -0
- package/src/cache/TokenCache.ts +484 -0
- package/src/config/Configuration.ts +375 -0
- package/src/controllers/ControllerFactory.ts +55 -0
- package/src/controllers/IController.ts +131 -0
- package/src/controllers/StandardController.ts +2107 -0
- package/src/crypto/BrowserCrypto.ts +135 -0
- package/src/crypto/CryptoOps.ts +247 -0
- package/src/crypto/ISubtleCrypto.ts +30 -0
- package/src/crypto/ModernBrowserCrypto.ts +69 -0
- package/src/crypto/PkceGenerator.ts +76 -0
- package/src/crypto/SignedHttpRequest.ts +76 -0
- package/src/encode/Base64Decode.ts +26 -0
- package/src/encode/Base64Encode.ts +52 -0
- package/src/error/BrowserAuthError.ts +340 -0
- package/src/error/BrowserAuthErrorCodes.ts +56 -0
- package/src/error/BrowserConfigurationAuthError.ts +133 -0
- package/src/error/NativeAuthError.ts +141 -0
- package/src/event/EventHandler.ts +176 -0
- package/src/event/EventMessage.ts +125 -0
- package/src/event/EventType.ts +33 -0
- package/src/index.ts +152 -0
- package/src/interaction_client/BaseInteractionClient.ts +301 -0
- package/src/interaction_client/HybridSpaAuthorizationCodeClient.ts +16 -0
- package/src/interaction_client/NativeInteractionClient.ts +907 -0
- package/src/interaction_client/PopupClient.ts +926 -0
- package/src/interaction_client/RedirectClient.ts +616 -0
- package/src/interaction_client/SilentAuthCodeClient.ts +163 -0
- package/src/interaction_client/SilentCacheClient.ts +133 -0
- package/src/interaction_client/SilentIframeClient.ts +301 -0
- package/src/interaction_client/SilentRefreshClient.ts +120 -0
- package/src/interaction_client/StandardInteractionClient.ts +481 -0
- package/src/interaction_handler/InteractionHandler.ts +246 -0
- package/src/interaction_handler/RedirectHandler.ts +225 -0
- package/src/interaction_handler/SilentHandler.ts +266 -0
- package/src/navigation/INavigationClient.ts +23 -0
- package/src/navigation/NavigationClient.ts +55 -0
- package/src/navigation/NavigationOptions.ts +18 -0
- package/src/network/FetchClient.ts +130 -0
- package/src/operatingcontext/BaseOperatingContext.ts +82 -0
- package/src/operatingcontext/StandardOperatingContext.ts +49 -0
- package/src/operatingcontext/TeamsAppOperatingContext.ts +48 -0
- package/src/packageMetadata.ts +3 -0
- package/src/request/AuthorizationCodeRequest.ts +19 -0
- package/src/request/AuthorizationUrlRequest.ts +17 -0
- package/src/request/ClearCacheRequest.ts +16 -0
- package/src/request/EndSessionPopupRequest.ts +26 -0
- package/src/request/EndSessionRequest.ts +23 -0
- package/src/request/PopupRequest.ts +51 -0
- package/src/request/PopupWindowAttributes.ts +22 -0
- package/src/request/RedirectRequest.ts +51 -0
- package/src/request/SilentRequest.ts +49 -0
- package/src/request/SsoSilentRequest.ts +44 -0
- package/src/response/AuthenticationResult.ts +13 -0
- package/src/telemetry/BrowserPerformanceClient.ts +226 -0
- package/src/telemetry/BrowserPerformanceMeasurement.ts +144 -0
- package/src/utils/BrowserConstants.ts +241 -0
- package/src/utils/BrowserProtocolUtils.ts +57 -0
- package/src/utils/BrowserStringUtils.ts +143 -0
- package/src/utils/BrowserUtils.ts +156 -0
- package/dist/crypto/GuidGenerator.d.ts +0 -13
- package/dist/crypto/GuidGenerator.d.ts.map +0 -1
- package/dist/crypto/GuidGenerator.mjs +0 -104
- package/dist/crypto/GuidGenerator.mjs.map +0 -1
- package/dist/internals.d.ts +0 -23
- package/dist/internals.d.ts.map +0 -1
- package/dist/internals.mjs +0 -28
- package/dist/internals.mjs.map +0 -1
- package/dist/network/XhrClient.d.ts +0 -41
- package/dist/network/XhrClient.d.ts.map +0 -1
- package/dist/network/XhrClient.mjs +0 -125
- package/dist/network/XhrClient.mjs.map +0 -1
- package/dist/utils/MathUtils.d.ts +0 -12
- package/dist/utils/MathUtils.d.ts.map +0 -1
- package/dist/utils/MathUtils.mjs +0 -26
- package/dist/utils/MathUtils.mjs.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Constants, UrlString } from "@azure/msal-common";
|
|
7
|
+
import {
|
|
8
|
+
createBrowserAuthError,
|
|
9
|
+
BrowserAuthErrorCodes,
|
|
10
|
+
} from "../error/BrowserAuthError";
|
|
11
|
+
import { InteractionType, BrowserConstants } from "./BrowserConstants";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Utility class for browser specific functions
|
|
15
|
+
*/
|
|
16
|
+
export class BrowserUtils {
|
|
17
|
+
// #region Window Navigation and URL management
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Clears hash from window url.
|
|
21
|
+
*/
|
|
22
|
+
static clearHash(contentWindow: Window): void {
|
|
23
|
+
// Office.js sets history.replaceState to null
|
|
24
|
+
contentWindow.location.hash = Constants.EMPTY_STRING;
|
|
25
|
+
if (typeof contentWindow.history.replaceState === "function") {
|
|
26
|
+
// Full removes "#" from url
|
|
27
|
+
contentWindow.history.replaceState(
|
|
28
|
+
null,
|
|
29
|
+
Constants.EMPTY_STRING,
|
|
30
|
+
`${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Replaces current hash with hash from provided url
|
|
37
|
+
*/
|
|
38
|
+
static replaceHash(url: string): void {
|
|
39
|
+
const urlParts = url.split("#");
|
|
40
|
+
urlParts.shift(); // Remove part before the hash
|
|
41
|
+
window.location.hash =
|
|
42
|
+
urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns boolean of whether the current window is in an iframe or not.
|
|
47
|
+
*/
|
|
48
|
+
static isInIframe(): boolean {
|
|
49
|
+
return window.parent !== window;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns boolean of whether or not the current window is a popup opened by msal
|
|
54
|
+
*/
|
|
55
|
+
static isInPopup(): boolean {
|
|
56
|
+
return (
|
|
57
|
+
typeof window !== "undefined" &&
|
|
58
|
+
!!window.opener &&
|
|
59
|
+
window.opener !== window &&
|
|
60
|
+
typeof window.name === "string" &&
|
|
61
|
+
window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// #endregion
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns current window URL as redirect uri
|
|
69
|
+
*/
|
|
70
|
+
static getCurrentUri(): string {
|
|
71
|
+
return window.location.href.split("?")[0].split("#")[0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Gets the homepage url for the current window location.
|
|
76
|
+
*/
|
|
77
|
+
static getHomepage(): string {
|
|
78
|
+
const currentUrl = new UrlString(window.location.href);
|
|
79
|
+
const urlComponents = currentUrl.getUrlComponents();
|
|
80
|
+
return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Throws error if we have completed an auth and are
|
|
85
|
+
* attempting another auth request inside an iframe.
|
|
86
|
+
*/
|
|
87
|
+
static blockReloadInHiddenIframes(): void {
|
|
88
|
+
const isResponseHash = UrlString.hashContainsKnownProperties(
|
|
89
|
+
window.location.hash
|
|
90
|
+
);
|
|
91
|
+
// return an error if called from the hidden iframe created by the msal js silent calls
|
|
92
|
+
if (isResponseHash && BrowserUtils.isInIframe()) {
|
|
93
|
+
throw createBrowserAuthError(
|
|
94
|
+
BrowserAuthErrorCodes.blockIframeReload
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Block redirect operations in iframes unless explicitly allowed
|
|
101
|
+
* @param interactionType Interaction type for the request
|
|
102
|
+
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
103
|
+
*/
|
|
104
|
+
static blockRedirectInIframe(
|
|
105
|
+
interactionType: InteractionType,
|
|
106
|
+
allowRedirectInIframe: boolean
|
|
107
|
+
): void {
|
|
108
|
+
const isIframedApp = BrowserUtils.isInIframe();
|
|
109
|
+
if (
|
|
110
|
+
interactionType === InteractionType.Redirect &&
|
|
111
|
+
isIframedApp &&
|
|
112
|
+
!allowRedirectInIframe
|
|
113
|
+
) {
|
|
114
|
+
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
|
|
115
|
+
throw createBrowserAuthError(
|
|
116
|
+
BrowserAuthErrorCodes.redirectInIframe
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Block redirectUri loaded in popup from calling AcquireToken APIs
|
|
123
|
+
*/
|
|
124
|
+
static blockAcquireTokenInPopups(): void {
|
|
125
|
+
// Popups opened by msal popup APIs are given a name that starts with "msal."
|
|
126
|
+
if (BrowserUtils.isInPopup()) {
|
|
127
|
+
throw createBrowserAuthError(
|
|
128
|
+
BrowserAuthErrorCodes.blockNestedPopups
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Throws error if token requests are made in non-browser environment
|
|
135
|
+
* @param isBrowserEnvironment Flag indicating if environment is a browser.
|
|
136
|
+
*/
|
|
137
|
+
static blockNonBrowserEnvironment(isBrowserEnvironment: boolean): void {
|
|
138
|
+
if (!isBrowserEnvironment) {
|
|
139
|
+
throw createBrowserAuthError(
|
|
140
|
+
BrowserAuthErrorCodes.nonBrowserEnvironment
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Throws error if initialize hasn't been called
|
|
147
|
+
* @param initialized
|
|
148
|
+
*/
|
|
149
|
+
static blockAPICallsBeforeInitialize(initialized: boolean): void {
|
|
150
|
+
if (!initialized) {
|
|
151
|
+
throw createBrowserAuthError(
|
|
152
|
+
BrowserAuthErrorCodes.uninitializedPublicClientApplication
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IGuidGenerator } from "@azure/msal-common";
|
|
2
|
-
import { BrowserCrypto } from "./BrowserCrypto";
|
|
3
|
-
export declare class GuidGenerator implements IGuidGenerator {
|
|
4
|
-
private cryptoObj;
|
|
5
|
-
constructor(cryptoObj: BrowserCrypto);
|
|
6
|
-
generateGuid(): string;
|
|
7
|
-
/**
|
|
8
|
-
* verifies if a string is GUID
|
|
9
|
-
* @param guid
|
|
10
|
-
*/
|
|
11
|
-
isGuid(guid: string): boolean;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=GuidGenerator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuidGenerator.d.ts","sourceRoot":"","sources":["../../src/crypto/GuidGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,qBAAa,aAAc,YAAW,cAAc;IAEhD,OAAO,CAAC,SAAS,CAAgB;gBAErB,SAAS,EAAE,aAAa;IA0BpC,YAAY,IAAI,MAAM;IA4DtB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAKhC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.1 2023-08-11 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { Constants } from '@azure/msal-common';
|
|
4
|
-
import { MathUtils } from '../utils/MathUtils.mjs';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/
|
|
10
|
-
class GuidGenerator {
|
|
11
|
-
constructor(cryptoObj) {
|
|
12
|
-
this.cryptoObj = cryptoObj;
|
|
13
|
-
}
|
|
14
|
-
/*
|
|
15
|
-
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or
|
|
16
|
-
* pseudo-random numbers.
|
|
17
|
-
* The algorithm is as follows:
|
|
18
|
-
* Set the two most significant bits (bits 6 and 7) of the
|
|
19
|
-
* clock_seq_hi_and_reserved to zero and one, respectively.
|
|
20
|
-
* Set the four most significant bits (bits 12 through 15) of the
|
|
21
|
-
* time_hi_and_version field to the 4-bit version number from
|
|
22
|
-
* Section 4.1.3. Version4
|
|
23
|
-
* Set all the other bits to randomly (or pseudo-randomly) chosen
|
|
24
|
-
* values.
|
|
25
|
-
* UUID = time-low "-" time-mid "-"time-high-and-version "-"clock-seq-reserved and low(2hexOctet)"-" node
|
|
26
|
-
* time-low = 4hexOctet
|
|
27
|
-
* time-mid = 2hexOctet
|
|
28
|
-
* time-high-and-version = 2hexOctet
|
|
29
|
-
* clock-seq-and-reserved = hexOctet:
|
|
30
|
-
* clock-seq-low = hexOctet
|
|
31
|
-
* node = 6hexOctet
|
|
32
|
-
* Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
33
|
-
* y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10
|
|
34
|
-
* y values are 8, 9, A, B
|
|
35
|
-
*/
|
|
36
|
-
generateGuid() {
|
|
37
|
-
try {
|
|
38
|
-
const buffer = new Uint8Array(16);
|
|
39
|
-
this.cryptoObj.getRandomValues(buffer);
|
|
40
|
-
// buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).
|
|
41
|
-
buffer[6] |= 0x40; // buffer[6] | 01000000 will set the 6 bit to 1.
|
|
42
|
-
buffer[6] &= 0x4f; // buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = "4".
|
|
43
|
-
// buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.
|
|
44
|
-
buffer[8] |= 0x80; // buffer[8] | 10000000 will set the 7 bit to 1.
|
|
45
|
-
buffer[8] &= 0xbf; // buffer[8] & 10111111 will set the 6 bit to 0.
|
|
46
|
-
return (MathUtils.decimalToHex(buffer[0]) +
|
|
47
|
-
MathUtils.decimalToHex(buffer[1]) +
|
|
48
|
-
MathUtils.decimalToHex(buffer[2]) +
|
|
49
|
-
MathUtils.decimalToHex(buffer[3]) +
|
|
50
|
-
"-" +
|
|
51
|
-
MathUtils.decimalToHex(buffer[4]) +
|
|
52
|
-
MathUtils.decimalToHex(buffer[5]) +
|
|
53
|
-
"-" +
|
|
54
|
-
MathUtils.decimalToHex(buffer[6]) +
|
|
55
|
-
MathUtils.decimalToHex(buffer[7]) +
|
|
56
|
-
"-" +
|
|
57
|
-
MathUtils.decimalToHex(buffer[8]) +
|
|
58
|
-
MathUtils.decimalToHex(buffer[9]) +
|
|
59
|
-
"-" +
|
|
60
|
-
MathUtils.decimalToHex(buffer[10]) +
|
|
61
|
-
MathUtils.decimalToHex(buffer[11]) +
|
|
62
|
-
MathUtils.decimalToHex(buffer[12]) +
|
|
63
|
-
MathUtils.decimalToHex(buffer[13]) +
|
|
64
|
-
MathUtils.decimalToHex(buffer[14]) +
|
|
65
|
-
MathUtils.decimalToHex(buffer[15]));
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
const guidHolder = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
69
|
-
const hex = "0123456789abcdef";
|
|
70
|
-
let r = 0;
|
|
71
|
-
let guidResponse = Constants.EMPTY_STRING;
|
|
72
|
-
for (let i = 0; i < 36; i++) {
|
|
73
|
-
if (guidHolder[i] !== "-" && guidHolder[i] !== "4") {
|
|
74
|
-
// each x and y needs to be random
|
|
75
|
-
r = (Math.random() * 16) | 0;
|
|
76
|
-
}
|
|
77
|
-
if (guidHolder[i] === "x") {
|
|
78
|
-
guidResponse += hex[r];
|
|
79
|
-
}
|
|
80
|
-
else if (guidHolder[i] === "y") {
|
|
81
|
-
// clock-seq-and-reserved first hex is filtered and remaining hex values are random
|
|
82
|
-
r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??
|
|
83
|
-
r |= 0x8; // set pos 3 to 1 as 1???
|
|
84
|
-
guidResponse += hex[r];
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
guidResponse += guidHolder[i];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return guidResponse;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* verifies if a string is GUID
|
|
95
|
-
* @param guid
|
|
96
|
-
*/
|
|
97
|
-
isGuid(guid) {
|
|
98
|
-
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
99
|
-
return regexGuid.test(guid);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { GuidGenerator };
|
|
104
|
-
//# sourceMappingURL=GuidGenerator.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuidGenerator.mjs","sources":["../../src/crypto/GuidGenerator.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;MAKU,aAAa,CAAA;AAItB,IAAA,WAAA,CAAY,SAAwB,EAAA;AAChC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;AAED;;;;;;;;;;;;;;;;;;;;;AAqBG;IACH,YAAY,GAAA;QACR,IAAI;AACA,YA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,CAAC,IAAY,EAAA;QACf,MAAM,SAAS,GACX,4EAA4E,CAAC;AACjF,QAAA,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC/B;AACJ;;;;"}
|
package/dist/internals.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Warning: This set of exports is purely intended to be used by other MSAL libraries, and should be considered potentially unstable. We strongly discourage using them directly, you do so at your own risk.
|
|
3
|
-
* Breaking changes to these APIs will be shipped under a minor version, instead of a major version.
|
|
4
|
-
*/
|
|
5
|
-
export { BrowserCacheManager } from "./cache/BrowserCacheManager";
|
|
6
|
-
export { CacheRecord } from "@azure/msal-common";
|
|
7
|
-
export { StandardInteractionClient } from "./interaction_client/StandardInteractionClient";
|
|
8
|
-
export { RedirectClient } from "./interaction_client/RedirectClient";
|
|
9
|
-
export { PopupClient } from "./interaction_client/PopupClient";
|
|
10
|
-
export { SilentIframeClient } from "./interaction_client/SilentIframeClient";
|
|
11
|
-
export { SilentCacheClient } from "./interaction_client/SilentCacheClient";
|
|
12
|
-
export { SilentRefreshClient } from "./interaction_client/SilentRefreshClient";
|
|
13
|
-
export { NativeInteractionClient } from "./interaction_client/NativeInteractionClient";
|
|
14
|
-
export { RedirectHandler } from "./interaction_handler/RedirectHandler";
|
|
15
|
-
export { EventHandler } from "./event/EventHandler";
|
|
16
|
-
export { NativeMessageHandler } from "./broker/nativeBroker/NativeMessageHandler";
|
|
17
|
-
export { BrowserStateObject } from "./utils/BrowserProtocolUtils";
|
|
18
|
-
export { BrowserConstants, TemporaryCacheKeys } from "./utils/BrowserConstants";
|
|
19
|
-
export { CryptoOps } from "./crypto/CryptoOps";
|
|
20
|
-
export { NativeAuthError } from "./error/NativeAuthError";
|
|
21
|
-
export { NativeTokenRequest } from "./broker/nativeBroker/NativeRequest";
|
|
22
|
-
export { NativeResponse, MATS } from "./broker/nativeBroker/NativeResponse";
|
|
23
|
-
//# sourceMappingURL=internals.d.ts.map
|
package/dist/internals.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAGvF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/internals.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.1 2023-08-11 */
|
|
2
|
-
'use strict';
|
|
3
|
-
export { BrowserCacheManager } from './cache/BrowserCacheManager.mjs';
|
|
4
|
-
export { CacheRecord } from '@azure/msal-common';
|
|
5
|
-
export { StandardInteractionClient } from './interaction_client/StandardInteractionClient.mjs';
|
|
6
|
-
export { RedirectClient } from './interaction_client/RedirectClient.mjs';
|
|
7
|
-
export { PopupClient } from './interaction_client/PopupClient.mjs';
|
|
8
|
-
export { SilentIframeClient } from './interaction_client/SilentIframeClient.mjs';
|
|
9
|
-
export { SilentCacheClient } from './interaction_client/SilentCacheClient.mjs';
|
|
10
|
-
export { SilentRefreshClient } from './interaction_client/SilentRefreshClient.mjs';
|
|
11
|
-
export { NativeInteractionClient } from './interaction_client/NativeInteractionClient.mjs';
|
|
12
|
-
export { RedirectHandler } from './interaction_handler/RedirectHandler.mjs';
|
|
13
|
-
export { EventHandler } from './event/EventHandler.mjs';
|
|
14
|
-
export { NativeMessageHandler } from './broker/nativeBroker/NativeMessageHandler.mjs';
|
|
15
|
-
export { BrowserConstants, TemporaryCacheKeys } from './utils/BrowserConstants.mjs';
|
|
16
|
-
export { CryptoOps } from './crypto/CryptoOps.mjs';
|
|
17
|
-
export { NativeAuthError } from './error/NativeAuthError.mjs';
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
21
|
-
* Licensed under the MIT License.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Warning: This set of exports is purely intended to be used by other MSAL libraries, and should be considered potentially unstable. We strongly discourage using them directly, you do so at your own risk.
|
|
25
|
-
* Breaking changes to these APIs will be shipped under a minor version, instead of a major version.
|
|
26
|
-
*/
|
|
27
|
-
// Cache Manager
|
|
28
|
-
//# sourceMappingURL=internals.mjs.map
|
package/dist/internals.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internals.mjs","sources":["../src/internals.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;AAGG;AAEH;;;AAGG;AAEH"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* This client implements the XMLHttpRequest class to send GET and POST requests.
|
|
4
|
-
*/
|
|
5
|
-
export declare class XhrClient implements INetworkModule {
|
|
6
|
-
/**
|
|
7
|
-
* XhrClient for REST endpoints - Get request
|
|
8
|
-
* @param url
|
|
9
|
-
* @param headers
|
|
10
|
-
* @param body
|
|
11
|
-
*/
|
|
12
|
-
sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
|
|
13
|
-
/**
|
|
14
|
-
* XhrClient for REST endpoints - Post request
|
|
15
|
-
* @param url
|
|
16
|
-
* @param headers
|
|
17
|
-
* @param body
|
|
18
|
-
*/
|
|
19
|
-
sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
|
|
20
|
-
/**
|
|
21
|
-
* Helper for XhrClient requests.
|
|
22
|
-
* @param url
|
|
23
|
-
* @param method
|
|
24
|
-
* @param options
|
|
25
|
-
*/
|
|
26
|
-
private sendRequestAsync;
|
|
27
|
-
/**
|
|
28
|
-
* Helper to set XHR headers for request.
|
|
29
|
-
* @param xhr
|
|
30
|
-
* @param options
|
|
31
|
-
*/
|
|
32
|
-
private setXhrHeaders;
|
|
33
|
-
/**
|
|
34
|
-
* Gets a string map of the headers received in the response.
|
|
35
|
-
*
|
|
36
|
-
* Algorithm comes from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders
|
|
37
|
-
* @param xhr
|
|
38
|
-
*/
|
|
39
|
-
private getHeaderDict;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=XhrClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XhrClient.d.ts","sourceRoot":"","sources":["../../src/network/XhrClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,cAAc,EACd,qBAAqB,EACrB,eAAe,EAClB,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,qBAAa,SAAU,YAAW,cAAc;IAC5C;;;;;OAKG;IACG,mBAAmB,CAAC,CAAC,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAI9B;;;;;OAKG;IACG,oBAAoB,CAAC,CAAC,EACxB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAI9B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IA8ExB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAYrB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;CAexB"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.1 2023-08-11 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { BrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
4
|
-
import { HTTP_REQUEST_TYPE } from '../utils/BrowserConstants.mjs';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* This client implements the XMLHttpRequest class to send GET and POST requests.
|
|
12
|
-
*/
|
|
13
|
-
class XhrClient {
|
|
14
|
-
/**
|
|
15
|
-
* XhrClient for REST endpoints - Get request
|
|
16
|
-
* @param url
|
|
17
|
-
* @param headers
|
|
18
|
-
* @param body
|
|
19
|
-
*/
|
|
20
|
-
async sendGetRequestAsync(url, options) {
|
|
21
|
-
return this.sendRequestAsync(url, HTTP_REQUEST_TYPE.GET, options);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* XhrClient for REST endpoints - Post request
|
|
25
|
-
* @param url
|
|
26
|
-
* @param headers
|
|
27
|
-
* @param body
|
|
28
|
-
*/
|
|
29
|
-
async sendPostRequestAsync(url, options) {
|
|
30
|
-
return this.sendRequestAsync(url, HTTP_REQUEST_TYPE.POST, options);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Helper for XhrClient requests.
|
|
34
|
-
* @param url
|
|
35
|
-
* @param method
|
|
36
|
-
* @param options
|
|
37
|
-
*/
|
|
38
|
-
sendRequestAsync(url, method, options) {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const xhr = new XMLHttpRequest();
|
|
41
|
-
xhr.open(method, url, /* async: */ true);
|
|
42
|
-
this.setXhrHeaders(xhr, options);
|
|
43
|
-
xhr.onload = () => {
|
|
44
|
-
if (xhr.status < 200 || xhr.status >= 300) {
|
|
45
|
-
if (method === HTTP_REQUEST_TYPE.POST) {
|
|
46
|
-
reject(BrowserAuthError.createPostRequestFailedError(`Failed with status ${xhr.status}`, url));
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
reject(BrowserAuthError.createGetRequestFailedError(`Failed with status ${xhr.status}`, url));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
const jsonResponse = JSON.parse(xhr.responseText);
|
|
54
|
-
const networkResponse = {
|
|
55
|
-
headers: this.getHeaderDict(xhr),
|
|
56
|
-
body: jsonResponse,
|
|
57
|
-
status: xhr.status,
|
|
58
|
-
};
|
|
59
|
-
resolve(networkResponse);
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
reject(BrowserAuthError.createFailedToParseNetworkResponseError(url));
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
xhr.onerror = () => {
|
|
66
|
-
if (window.navigator.onLine) {
|
|
67
|
-
if (method === HTTP_REQUEST_TYPE.POST) {
|
|
68
|
-
reject(BrowserAuthError.createPostRequestFailedError(`Failed with status ${xhr.status}`, url));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
reject(BrowserAuthError.createGetRequestFailedError(`Failed with status ${xhr.status}`, url));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
reject(BrowserAuthError.createNoNetworkConnectivityError());
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
if (method === HTTP_REQUEST_TYPE.POST && options && options.body) {
|
|
79
|
-
xhr.send(options.body);
|
|
80
|
-
}
|
|
81
|
-
else if (method === HTTP_REQUEST_TYPE.GET) {
|
|
82
|
-
xhr.send();
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw BrowserAuthError.createHttpMethodNotImplementedError(method);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Helper to set XHR headers for request.
|
|
91
|
-
* @param xhr
|
|
92
|
-
* @param options
|
|
93
|
-
*/
|
|
94
|
-
setXhrHeaders(xhr, options) {
|
|
95
|
-
if (options && options.headers) {
|
|
96
|
-
const headers = options.headers;
|
|
97
|
-
Object.keys(headers).forEach((key) => {
|
|
98
|
-
xhr.setRequestHeader(key, headers[key]);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Gets a string map of the headers received in the response.
|
|
104
|
-
*
|
|
105
|
-
* Algorithm comes from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders
|
|
106
|
-
* @param xhr
|
|
107
|
-
*/
|
|
108
|
-
getHeaderDict(xhr) {
|
|
109
|
-
const headerString = xhr.getAllResponseHeaders();
|
|
110
|
-
const headerArr = headerString.trim().split(/[\r\n]+/);
|
|
111
|
-
const headerDict = {};
|
|
112
|
-
headerArr.forEach((value) => {
|
|
113
|
-
const parts = value.split(": ");
|
|
114
|
-
const headerName = parts.shift();
|
|
115
|
-
const headerVal = parts.join(": ");
|
|
116
|
-
if (headerName && headerVal) {
|
|
117
|
-
headerDict[headerName] = headerVal;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return headerDict;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export { XhrClient };
|
|
125
|
-
//# sourceMappingURL=XhrClient.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XhrClient.mjs","sources":["../../src/network/XhrClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAUH;;AAEG;MACU,SAAS,CAAA;AAClB;;;;;AAKG;AACH,IAAA,MAAM,mBAAmB,CACrB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACrE;AAED;;;;;AAKG;AACH,IAAA,MAAM,oBAAoB,CACtB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACtE;AAED;;;;;AAKG;AACK,IAAA,gBAAgB,CACpB,GAAW,EACX,MAAyB,EACzB,OAA+B,EAAA;QAE/B,OAAO,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,KAAI;AACvD,YAAA,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,eAAe,IAAI,CAAC,CAAC;AACzC,YAAA,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjC,YAAA,GAAG,CAAC,MAAM,GAAG,MAAW;gBACpB,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE;AACvC,oBAAA,IAAI,MAAM,KAAK,iBAAiB,CAAC,IAAI,EAAE;AACnC,wBAAA,MAAM,CACF,gBA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CAAC,KAAK,EAAE,CAAC;YACjC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,UAAU,IAAI,SAAS,EAAE;AACzB,gBAAA,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;AACtC,aAAA;AACL,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,UAAU,CAAC;KACrB;AACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MathUtils.d.ts","sourceRoot":"","sources":["../../src/utils/MathUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,SAAS;IAClB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAO3C"}
|
package/dist/utils/MathUtils.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.1 2023-08-11 */
|
|
2
|
-
'use strict';
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Utility class for math specific functions in browser.
|
|
9
|
-
*/
|
|
10
|
-
class MathUtils {
|
|
11
|
-
/**
|
|
12
|
-
* Decimal to Hex
|
|
13
|
-
*
|
|
14
|
-
* @param num
|
|
15
|
-
*/
|
|
16
|
-
static decimalToHex(num) {
|
|
17
|
-
let hex = num.toString(16);
|
|
18
|
-
while (hex.length < 2) {
|
|
19
|
-
hex = "0" + hex;
|
|
20
|
-
}
|
|
21
|
-
return hex;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { MathUtils };
|
|
26
|
-
//# sourceMappingURL=MathUtils.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MathUtils.mjs","sources":["../../src/utils/MathUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;AAEG;MACU,SAAS,CAAA;AAClB;;;;AAIG;IACH,OAAO,YAAY,CAAC,GAAW,EAAA;QAC3B,IAAI,GAAG,GAAW,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACnC,QAAA,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;AACnB,YAAA,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACnB,SAAA;AACD,QAAA,OAAO,GAAG,CAAC;KACd;AACJ;;;;"}
|