@azure/msal-browser 3.26.0 → 3.27.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.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeRequest.d.ts +1 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +4 -3
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +22 -8
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +1 -8
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +2 -2
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +10 -7
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +2 -2
- 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.d.ts +4 -2
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +8 -6
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +2 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +5 -3
- package/dist/error/BrowserAuthErrorCodes.mjs.map +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.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -4
- 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 +25 -17
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +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.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +4 -5
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.d.ts +0 -6
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.mjs +51 -32
- package/dist/network/FetchClient.mjs.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.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/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- 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.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +476 -331
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +476 -331
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -66
- package/lib/types/broker/nativeBroker/NativeRequest.d.ts +1 -0
- package/lib/types/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts +2 -2
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthError.d.ts +4 -2
- package/lib/types/error/BrowserAuthError.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthErrorCodes.d.ts +2 -0
- package/lib/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/lib/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/lib/types/network/FetchClient.d.ts +0 -6
- package/lib/types/network/FetchClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/package.json +3 -3
- package/src/broker/nativeBroker/NativeRequest.ts +1 -0
- package/src/config/Configuration.ts +3 -1
- package/src/controllers/NestedAppAuthController.ts +25 -12
- package/src/controllers/StandardController.ts +0 -7
- package/src/crypto/BrowserCrypto.ts +15 -6
- package/src/crypto/CryptoOps.ts +1 -1
- package/src/error/BrowserAuthError.ts +11 -4
- package/src/error/BrowserAuthErrorCodes.ts +2 -0
- package/src/interaction_client/BaseInteractionClient.ts +1 -4
- package/src/interaction_client/NativeInteractionClient.ts +35 -25
- package/src/interaction_client/StandardInteractionClient.ts +1 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +4 -5
- package/src/network/FetchClient.ts +67 -40
- package/src/packageMetadata.ts +1 -1
|
@@ -72,7 +72,9 @@ export class NestedAppAuthAdapter {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
75
|
+
const correlationId =
|
|
76
|
+
request.correlationId || this.crypto.createNewGuid();
|
|
77
|
+
const requestBuilder = new RequestParameterBuilder(correlationId);
|
|
76
78
|
const claims = requestBuilder.addClientCapabilitiesToClaims(
|
|
77
79
|
request.claims,
|
|
78
80
|
this.clientCapabilities
|
|
@@ -83,10 +85,7 @@ export class NestedAppAuthAdapter {
|
|
|
83
85
|
clientId: this.clientId,
|
|
84
86
|
authority: request.authority,
|
|
85
87
|
scope: scopes.join(" "),
|
|
86
|
-
correlationId
|
|
87
|
-
request.correlationId !== undefined
|
|
88
|
-
? request.correlationId
|
|
89
|
-
: this.crypto.createNewGuid(),
|
|
88
|
+
correlationId,
|
|
90
89
|
claims: !StringUtils.isEmptyObj(claims) ? claims : undefined,
|
|
91
90
|
state: request.state,
|
|
92
91
|
authenticationScheme:
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
Constants,
|
|
8
7
|
INetworkModule,
|
|
9
8
|
NetworkRequestOptions,
|
|
10
9
|
NetworkResponse,
|
|
10
|
+
createNetworkError,
|
|
11
11
|
} from "@azure/msal-common/browser";
|
|
12
12
|
import {
|
|
13
13
|
createBrowserAuthError,
|
|
@@ -29,33 +29,38 @@ export class FetchClient implements INetworkModule {
|
|
|
29
29
|
url: string,
|
|
30
30
|
options?: NetworkRequestOptions
|
|
31
31
|
): Promise<NetworkResponse<T>> {
|
|
32
|
-
let response;
|
|
32
|
+
let response: Response;
|
|
33
|
+
let responseHeaders: Record<string, string> = {};
|
|
34
|
+
let responseStatus = 0;
|
|
35
|
+
const reqHeaders = getFetchHeaders(options);
|
|
33
36
|
try {
|
|
34
37
|
response = await fetch(url, {
|
|
35
38
|
method: HTTP_REQUEST_TYPE.GET,
|
|
36
|
-
headers:
|
|
39
|
+
headers: reqHeaders,
|
|
37
40
|
});
|
|
38
41
|
} catch (e) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
BrowserAuthErrorCodes.getRequestFailed
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
throw createBrowserAuthError(
|
|
45
|
-
BrowserAuthErrorCodes.noNetworkConnectivity
|
|
46
|
-
);
|
|
47
|
-
}
|
|
42
|
+
throw createBrowserAuthError(
|
|
43
|
+
window.navigator.onLine
|
|
44
|
+
? BrowserAuthErrorCodes.getRequestFailed
|
|
45
|
+
: BrowserAuthErrorCodes.noNetworkConnectivity
|
|
46
|
+
);
|
|
48
47
|
}
|
|
49
48
|
|
|
49
|
+
responseHeaders = getHeaderDict(response.headers);
|
|
50
50
|
try {
|
|
51
|
+
responseStatus = response.status;
|
|
51
52
|
return {
|
|
52
|
-
headers:
|
|
53
|
+
headers: responseHeaders,
|
|
53
54
|
body: (await response.json()) as T,
|
|
54
|
-
status:
|
|
55
|
+
status: responseStatus,
|
|
55
56
|
};
|
|
56
57
|
} catch (e) {
|
|
57
|
-
throw
|
|
58
|
-
|
|
58
|
+
throw createNetworkError(
|
|
59
|
+
createBrowserAuthError(
|
|
60
|
+
BrowserAuthErrorCodes.failedToParseResponse
|
|
61
|
+
),
|
|
62
|
+
responseStatus,
|
|
63
|
+
responseHeaders
|
|
59
64
|
);
|
|
60
65
|
}
|
|
61
66
|
}
|
|
@@ -70,61 +75,83 @@ export class FetchClient implements INetworkModule {
|
|
|
70
75
|
url: string,
|
|
71
76
|
options?: NetworkRequestOptions
|
|
72
77
|
): Promise<NetworkResponse<T>> {
|
|
73
|
-
const reqBody = (options && options.body) ||
|
|
78
|
+
const reqBody = (options && options.body) || "";
|
|
79
|
+
const reqHeaders = getFetchHeaders(options);
|
|
74
80
|
|
|
75
|
-
let response;
|
|
81
|
+
let response: Response;
|
|
82
|
+
let responseStatus = 0;
|
|
83
|
+
let responseHeaders: Record<string, string> = {};
|
|
76
84
|
try {
|
|
77
85
|
response = await fetch(url, {
|
|
78
86
|
method: HTTP_REQUEST_TYPE.POST,
|
|
79
|
-
headers:
|
|
87
|
+
headers: reqHeaders,
|
|
80
88
|
body: reqBody,
|
|
81
89
|
});
|
|
82
90
|
} catch (e) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
BrowserAuthErrorCodes.postRequestFailed
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
throw createBrowserAuthError(
|
|
89
|
-
BrowserAuthErrorCodes.noNetworkConnectivity
|
|
90
|
-
);
|
|
91
|
-
}
|
|
91
|
+
throw createBrowserAuthError(
|
|
92
|
+
window.navigator.onLine
|
|
93
|
+
? BrowserAuthErrorCodes.postRequestFailed
|
|
94
|
+
: BrowserAuthErrorCodes.noNetworkConnectivity
|
|
95
|
+
);
|
|
92
96
|
}
|
|
93
97
|
|
|
98
|
+
responseHeaders = getHeaderDict(response.headers);
|
|
94
99
|
try {
|
|
100
|
+
responseStatus = response.status;
|
|
95
101
|
return {
|
|
96
|
-
headers:
|
|
102
|
+
headers: responseHeaders,
|
|
97
103
|
body: (await response.json()) as T,
|
|
98
|
-
status:
|
|
104
|
+
status: responseStatus,
|
|
99
105
|
};
|
|
100
106
|
} catch (e) {
|
|
101
|
-
throw
|
|
102
|
-
|
|
107
|
+
throw createNetworkError(
|
|
108
|
+
createBrowserAuthError(
|
|
109
|
+
BrowserAuthErrorCodes.failedToParseResponse
|
|
110
|
+
),
|
|
111
|
+
responseStatus,
|
|
112
|
+
responseHeaders
|
|
103
113
|
);
|
|
104
114
|
}
|
|
105
115
|
}
|
|
116
|
+
}
|
|
106
117
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Get Fetch API Headers object from string map
|
|
120
|
+
* @param inputHeaders
|
|
121
|
+
*/
|
|
122
|
+
function getFetchHeaders(options?: NetworkRequestOptions): Headers {
|
|
123
|
+
try {
|
|
112
124
|
const headers = new Headers();
|
|
113
125
|
if (!(options && options.headers)) {
|
|
114
126
|
return headers;
|
|
115
127
|
}
|
|
116
128
|
const optionsHeaders = options.headers;
|
|
117
|
-
Object.
|
|
118
|
-
headers.append(key,
|
|
129
|
+
Object.entries(optionsHeaders).forEach(([key, value]) => {
|
|
130
|
+
headers.append(key, value);
|
|
119
131
|
});
|
|
120
132
|
return headers;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
throw createBrowserAuthError(
|
|
135
|
+
BrowserAuthErrorCodes.failedToBuildHeaders
|
|
136
|
+
);
|
|
121
137
|
}
|
|
138
|
+
}
|
|
122
139
|
|
|
123
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Returns object representing response headers
|
|
142
|
+
* @param headers
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
function getHeaderDict(headers: Headers): Record<string, string> {
|
|
146
|
+
try {
|
|
124
147
|
const headerDict: Record<string, string> = {};
|
|
125
148
|
headers.forEach((value: string, key: string) => {
|
|
126
149
|
headerDict[key] = value;
|
|
127
150
|
});
|
|
128
151
|
return headerDict;
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw createBrowserAuthError(
|
|
154
|
+
BrowserAuthErrorCodes.failedToParseHeaders
|
|
155
|
+
);
|
|
129
156
|
}
|
|
130
157
|
}
|
package/src/packageMetadata.ts
CHANGED