@azure/msal-browser 3.1.0 → 3.2.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.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +20 -19
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +14 -6
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +17 -7
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +3 -4
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +13 -13
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +8 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts.map +1 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +16 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs.map +1 -0
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +3 -3
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +8 -7
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.mjs +7 -9
- package/dist/cache/BrowserStorage.mjs.map +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.mjs +1 -1
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +7 -7
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/IController.d.ts +3 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +11 -6
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +53 -34
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +44 -49
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +76 -76
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -7
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +11 -19
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +6 -21
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +45 -46
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +18 -2
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.d.ts +10 -1
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +12 -3
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.d.ts +9 -46
- package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +20 -73
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +4 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +12 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs.map +1 -0
- package/dist/error/NativeAuthError.d.ts +17 -45
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.mjs +47 -78
- package/dist/error/NativeAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthErrorCodes.d.ts +3 -0
- package/dist/error/NativeAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/NativeAuthErrorCodes.mjs +11 -0
- package/dist/error/NativeAuthErrorCodes.mjs.map +1 -0
- package/dist/event/EventHandler.d.ts.map +1 -1
- package/dist/event/EventHandler.mjs +3 -2
- package/dist/event/EventHandler.mjs.map +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +7 -8
- 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 +12 -10
- 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.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +5 -8
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +10 -18
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +2 -2
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +8 -18
- 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 +12 -33
- 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 +6 -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 +3 -3
- 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 +3 -4
- package/dist/interaction_handler/SilentHandler.mjs.map +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/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- 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.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/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +1413 -1727
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1413 -1727
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -65
- package/package.json +2 -2
- package/src/app/IPublicClientApplication.ts +55 -18
- package/src/app/PublicClientApplication.ts +18 -6
- package/src/broker/nativeBroker/NativeMessageHandler.ts +12 -15
- package/src/broker/nativeBroker/NativeStatusCodes.ts +13 -0
- package/src/cache/BrowserCacheManager.ts +21 -6
- package/src/cache/BrowserStorage.ts +9 -11
- package/src/config/Configuration.ts +16 -8
- package/src/controllers/IController.ts +4 -1
- package/src/controllers/StandardController.ts +155 -92
- package/src/crypto/BrowserCrypto.ts +118 -102
- package/src/crypto/CryptoOps.ts +10 -22
- package/src/crypto/PkceGenerator.ts +93 -54
- package/src/encode/Base64Decode.ts +21 -1
- package/src/error/BrowserAuthError.ts +13 -1
- package/src/error/BrowserAuthErrorCodes.ts +1 -0
- package/src/error/BrowserConfigurationAuthError.ts +33 -102
- package/src/error/BrowserConfigurationAuthErrorCodes.ts +9 -0
- package/src/error/NativeAuthError.ts +73 -101
- package/src/error/NativeAuthErrorCodes.ts +7 -0
- package/src/event/EventHandler.ts +2 -1
- package/src/index.ts +5 -0
- package/src/interaction_client/BaseInteractionClient.ts +13 -7
- package/src/interaction_client/NativeInteractionClient.ts +29 -11
- package/src/interaction_client/SilentAuthCodeClient.ts +18 -16
- package/src/interaction_client/SilentCacheClient.ts +22 -30
- package/src/interaction_client/SilentIframeClient.ts +1 -1
- package/src/interaction_client/SilentRefreshClient.ts +26 -28
- package/src/interaction_client/StandardInteractionClient.ts +36 -67
- package/src/interaction_handler/InteractionHandler.ts +20 -15
- package/src/interaction_handler/RedirectHandler.ts +6 -2
- package/src/interaction_handler/SilentHandler.ts +6 -3
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserProtocolUtils.ts +3 -2
- package/dist/crypto/ISubtleCrypto.d.ts +0 -10
- package/dist/crypto/ISubtleCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.d.ts +0 -10
- package/dist/crypto/ModernBrowserCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.mjs +0 -31
- package/dist/crypto/ModernBrowserCrypto.mjs.map +0 -1
- package/src/crypto/ISubtleCrypto.ts +0 -30
- package/src/crypto/ModernBrowserCrypto.ts +0 -69
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.2.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.0
|
|
103
|
+
"@azure/msal-common": "14.1.0"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -13,7 +13,10 @@ import { PopupRequest } from "../request/PopupRequest";
|
|
|
13
13
|
import { SilentRequest } from "../request/SilentRequest";
|
|
14
14
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
15
15
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BrowserConfigurationAuthErrorCodes,
|
|
18
|
+
createBrowserConfigurationAuthError,
|
|
19
|
+
} from "../error/BrowserConfigurationAuthError";
|
|
17
20
|
import { WrapperSKU } from "../utils/BrowserConstants";
|
|
18
21
|
import { INavigationClient } from "../navigation/INavigationClient";
|
|
19
22
|
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
|
|
@@ -74,27 +77,37 @@ export interface IPublicClientApplication {
|
|
|
74
77
|
export const stubbedPublicClientApplication: IPublicClientApplication = {
|
|
75
78
|
initialize: () => {
|
|
76
79
|
return Promise.reject(
|
|
77
|
-
|
|
80
|
+
createBrowserConfigurationAuthError(
|
|
81
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
82
|
+
)
|
|
78
83
|
);
|
|
79
84
|
},
|
|
80
85
|
acquireTokenPopup: () => {
|
|
81
86
|
return Promise.reject(
|
|
82
|
-
|
|
87
|
+
createBrowserConfigurationAuthError(
|
|
88
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
89
|
+
)
|
|
83
90
|
);
|
|
84
91
|
},
|
|
85
92
|
acquireTokenRedirect: () => {
|
|
86
93
|
return Promise.reject(
|
|
87
|
-
|
|
94
|
+
createBrowserConfigurationAuthError(
|
|
95
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
96
|
+
)
|
|
88
97
|
);
|
|
89
98
|
},
|
|
90
99
|
acquireTokenSilent: () => {
|
|
91
100
|
return Promise.reject(
|
|
92
|
-
|
|
101
|
+
createBrowserConfigurationAuthError(
|
|
102
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
103
|
+
)
|
|
93
104
|
);
|
|
94
105
|
},
|
|
95
106
|
acquireTokenByCode: () => {
|
|
96
107
|
return Promise.reject(
|
|
97
|
-
|
|
108
|
+
createBrowserConfigurationAuthError(
|
|
109
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
110
|
+
)
|
|
98
111
|
);
|
|
99
112
|
},
|
|
100
113
|
getAllAccounts: () => {
|
|
@@ -111,37 +124,51 @@ export const stubbedPublicClientApplication: IPublicClientApplication = {
|
|
|
111
124
|
},
|
|
112
125
|
handleRedirectPromise: () => {
|
|
113
126
|
return Promise.reject(
|
|
114
|
-
|
|
127
|
+
createBrowserConfigurationAuthError(
|
|
128
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
129
|
+
)
|
|
115
130
|
);
|
|
116
131
|
},
|
|
117
132
|
loginPopup: () => {
|
|
118
133
|
return Promise.reject(
|
|
119
|
-
|
|
134
|
+
createBrowserConfigurationAuthError(
|
|
135
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
136
|
+
)
|
|
120
137
|
);
|
|
121
138
|
},
|
|
122
139
|
loginRedirect: () => {
|
|
123
140
|
return Promise.reject(
|
|
124
|
-
|
|
141
|
+
createBrowserConfigurationAuthError(
|
|
142
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
143
|
+
)
|
|
125
144
|
);
|
|
126
145
|
},
|
|
127
146
|
logout: () => {
|
|
128
147
|
return Promise.reject(
|
|
129
|
-
|
|
148
|
+
createBrowserConfigurationAuthError(
|
|
149
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
150
|
+
)
|
|
130
151
|
);
|
|
131
152
|
},
|
|
132
153
|
logoutRedirect: () => {
|
|
133
154
|
return Promise.reject(
|
|
134
|
-
|
|
155
|
+
createBrowserConfigurationAuthError(
|
|
156
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
157
|
+
)
|
|
135
158
|
);
|
|
136
159
|
},
|
|
137
160
|
logoutPopup: () => {
|
|
138
161
|
return Promise.reject(
|
|
139
|
-
|
|
162
|
+
createBrowserConfigurationAuthError(
|
|
163
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
164
|
+
)
|
|
140
165
|
);
|
|
141
166
|
},
|
|
142
167
|
ssoSilent: () => {
|
|
143
168
|
return Promise.reject(
|
|
144
|
-
|
|
169
|
+
createBrowserConfigurationAuthError(
|
|
170
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
171
|
+
)
|
|
145
172
|
);
|
|
146
173
|
},
|
|
147
174
|
addEventCallback: () => {
|
|
@@ -163,10 +190,14 @@ export const stubbedPublicClientApplication: IPublicClientApplication = {
|
|
|
163
190
|
return;
|
|
164
191
|
},
|
|
165
192
|
getTokenCache: () => {
|
|
166
|
-
throw
|
|
193
|
+
throw createBrowserConfigurationAuthError(
|
|
194
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
195
|
+
);
|
|
167
196
|
},
|
|
168
197
|
getLogger: () => {
|
|
169
|
-
throw
|
|
198
|
+
throw createBrowserConfigurationAuthError(
|
|
199
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
200
|
+
);
|
|
170
201
|
},
|
|
171
202
|
setLogger: () => {
|
|
172
203
|
return;
|
|
@@ -184,16 +215,22 @@ export const stubbedPublicClientApplication: IPublicClientApplication = {
|
|
|
184
215
|
return;
|
|
185
216
|
},
|
|
186
217
|
getConfiguration: () => {
|
|
187
|
-
throw
|
|
218
|
+
throw createBrowserConfigurationAuthError(
|
|
219
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
220
|
+
);
|
|
188
221
|
},
|
|
189
222
|
hydrateCache: () => {
|
|
190
223
|
return Promise.reject(
|
|
191
|
-
|
|
224
|
+
createBrowserConfigurationAuthError(
|
|
225
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
226
|
+
)
|
|
192
227
|
);
|
|
193
228
|
},
|
|
194
229
|
clearCache: () => {
|
|
195
230
|
return Promise.reject(
|
|
196
|
-
|
|
231
|
+
createBrowserConfigurationAuthError(
|
|
232
|
+
BrowserConfigurationAuthErrorCodes.stubbedPublicClientApplicationCalled
|
|
233
|
+
)
|
|
197
234
|
);
|
|
198
235
|
},
|
|
199
236
|
};
|
|
@@ -15,6 +15,7 @@ import { IController } from "../controllers/IController";
|
|
|
15
15
|
import {
|
|
16
16
|
PerformanceCallbackFunction,
|
|
17
17
|
AccountInfo,
|
|
18
|
+
AccountFilter,
|
|
18
19
|
Logger,
|
|
19
20
|
} from "@azure/msal-common";
|
|
20
21
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
@@ -188,12 +189,22 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
188
189
|
this.controller.disableAccountStorageEvents();
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Returns the first account found in the cache that matches the account filter passed in.
|
|
194
|
+
* @param accountFilter
|
|
195
|
+
* @returns The first account found in the cache matching the provided filter or null if no account could be found.
|
|
196
|
+
*/
|
|
197
|
+
getAccount(accountFilter: AccountFilter): AccountInfo | null {
|
|
198
|
+
return this.controller.getAccount(accountFilter);
|
|
199
|
+
}
|
|
200
|
+
|
|
191
201
|
/**
|
|
192
202
|
* Returns the signed in account matching homeAccountId.
|
|
193
203
|
* (the account object is created at the time of successful login)
|
|
194
204
|
* or null when no matching account is found
|
|
195
205
|
* @param homeAccountId
|
|
196
206
|
* @returns The account object stored in MSAL
|
|
207
|
+
* @deprecated - Use getAccount instead
|
|
197
208
|
*/
|
|
198
209
|
getAccountByHomeId(homeAccountId: string): AccountInfo | null {
|
|
199
210
|
return this.controller.getAccountByHomeId(homeAccountId);
|
|
@@ -205,6 +216,7 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
205
216
|
* or null when no matching account is found
|
|
206
217
|
* @param localAccountId
|
|
207
218
|
* @returns The account object stored in MSAL
|
|
219
|
+
* @deprecated - Use getAccount instead
|
|
208
220
|
*/
|
|
209
221
|
getAccountByLocalId(localId: string): AccountInfo | null {
|
|
210
222
|
return this.controller.getAccountByLocalId(localId);
|
|
@@ -217,19 +229,19 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
217
229
|
* This API is provided for convenience but getAccountById should be used for best reliability
|
|
218
230
|
* @param userName
|
|
219
231
|
* @returns The account object stored in MSAL
|
|
232
|
+
* @deprecated - Use getAccount instead
|
|
220
233
|
*/
|
|
221
234
|
getAccountByUsername(userName: string): AccountInfo | null {
|
|
222
235
|
return this.controller.getAccountByUsername(userName);
|
|
223
236
|
}
|
|
224
237
|
|
|
225
238
|
/**
|
|
226
|
-
* Returns all accounts that
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* @returns Array of account objects in cache
|
|
239
|
+
* Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
|
|
240
|
+
* @param accountFilter - (Optional) filter to narrow down the accounts returned
|
|
241
|
+
* @returns Array of AccountInfo objects in cache
|
|
230
242
|
*/
|
|
231
|
-
getAllAccounts(): AccountInfo[] {
|
|
232
|
-
return this.controller.getAllAccounts();
|
|
243
|
+
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[] {
|
|
244
|
+
return this.controller.getAllAccounts(accountFilter);
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
/**
|
|
@@ -10,22 +10,24 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
Logger,
|
|
12
12
|
AuthError,
|
|
13
|
+
createAuthError,
|
|
14
|
+
AuthErrorCodes,
|
|
13
15
|
AuthenticationScheme,
|
|
14
16
|
InProgressPerformanceEvent,
|
|
15
17
|
PerformanceEvents,
|
|
16
18
|
IPerformanceClient,
|
|
17
|
-
ICrypto,
|
|
18
19
|
} from "@azure/msal-common";
|
|
19
20
|
import {
|
|
20
21
|
NativeExtensionRequest,
|
|
21
22
|
NativeExtensionRequestBody,
|
|
22
23
|
} from "./NativeRequest";
|
|
23
|
-
import {
|
|
24
|
+
import { createNativeAuthError } from "../../error/NativeAuthError";
|
|
24
25
|
import {
|
|
25
26
|
createBrowserAuthError,
|
|
26
27
|
BrowserAuthErrorCodes,
|
|
27
28
|
} from "../../error/BrowserAuthError";
|
|
28
29
|
import { BrowserConfiguration } from "../../config/Configuration";
|
|
30
|
+
import { createNewGuid } from "../../crypto/BrowserCrypto";
|
|
29
31
|
|
|
30
32
|
type ResponseResolvers<T> = {
|
|
31
33
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
@@ -38,7 +40,6 @@ export class NativeMessageHandler {
|
|
|
38
40
|
private extensionId: string | undefined;
|
|
39
41
|
private extensionVersion: string | undefined;
|
|
40
42
|
private logger: Logger;
|
|
41
|
-
private crypto: ICrypto;
|
|
42
43
|
private readonly handshakeTimeoutMs: number;
|
|
43
44
|
private timeoutId: number | undefined;
|
|
44
45
|
private resolvers: Map<string, ResponseResolvers<object>>;
|
|
@@ -52,7 +53,6 @@ export class NativeMessageHandler {
|
|
|
52
53
|
logger: Logger,
|
|
53
54
|
handshakeTimeoutMs: number,
|
|
54
55
|
performanceClient: IPerformanceClient,
|
|
55
|
-
crypto: ICrypto,
|
|
56
56
|
extensionId?: string
|
|
57
57
|
) {
|
|
58
58
|
this.logger = logger;
|
|
@@ -66,7 +66,6 @@ export class NativeMessageHandler {
|
|
|
66
66
|
this.handshakeEvent = performanceClient.startMeasurement(
|
|
67
67
|
PerformanceEvents.NativeMessageHandlerHandshake
|
|
68
68
|
);
|
|
69
|
-
this.crypto = crypto;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
@@ -78,7 +77,7 @@ export class NativeMessageHandler {
|
|
|
78
77
|
const req: NativeExtensionRequest = {
|
|
79
78
|
channel: NativeConstants.CHANNEL_ID,
|
|
80
79
|
extensionId: this.extensionId,
|
|
81
|
-
responseId:
|
|
80
|
+
responseId: createNewGuid(),
|
|
82
81
|
body: body,
|
|
83
82
|
};
|
|
84
83
|
|
|
@@ -107,8 +106,7 @@ export class NativeMessageHandler {
|
|
|
107
106
|
static async createProvider(
|
|
108
107
|
logger: Logger,
|
|
109
108
|
handshakeTimeoutMs: number,
|
|
110
|
-
performanceClient: IPerformanceClient
|
|
111
|
-
crypto: ICrypto
|
|
109
|
+
performanceClient: IPerformanceClient
|
|
112
110
|
): Promise<NativeMessageHandler> {
|
|
113
111
|
logger.trace("NativeMessageHandler - createProvider called.");
|
|
114
112
|
try {
|
|
@@ -116,7 +114,6 @@ export class NativeMessageHandler {
|
|
|
116
114
|
logger,
|
|
117
115
|
handshakeTimeoutMs,
|
|
118
116
|
performanceClient,
|
|
119
|
-
crypto,
|
|
120
117
|
NativeConstants.PREFERRED_EXTENSION_ID
|
|
121
118
|
);
|
|
122
119
|
await preferredProvider.sendHandshakeRequest();
|
|
@@ -126,8 +123,7 @@ export class NativeMessageHandler {
|
|
|
126
123
|
const backupProvider = new NativeMessageHandler(
|
|
127
124
|
logger,
|
|
128
125
|
handshakeTimeoutMs,
|
|
129
|
-
performanceClient
|
|
130
|
-
crypto
|
|
126
|
+
performanceClient
|
|
131
127
|
);
|
|
132
128
|
await backupProvider.sendHandshakeRequest();
|
|
133
129
|
return backupProvider;
|
|
@@ -147,7 +143,7 @@ export class NativeMessageHandler {
|
|
|
147
143
|
const req: NativeExtensionRequest = {
|
|
148
144
|
channel: NativeConstants.CHANNEL_ID,
|
|
149
145
|
extensionId: this.extensionId,
|
|
150
|
-
responseId:
|
|
146
|
+
responseId: createNewGuid(),
|
|
151
147
|
body: {
|
|
152
148
|
method: NativeExtensionMethod.HandshakeRequest,
|
|
153
149
|
},
|
|
@@ -283,7 +279,7 @@ export class NativeMessageHandler {
|
|
|
283
279
|
);
|
|
284
280
|
if (response.status !== "Success") {
|
|
285
281
|
resolver.reject(
|
|
286
|
-
|
|
282
|
+
createNativeAuthError(
|
|
287
283
|
response.code,
|
|
288
284
|
response.description,
|
|
289
285
|
response.ext
|
|
@@ -295,7 +291,7 @@ export class NativeMessageHandler {
|
|
|
295
291
|
response.result["description"]
|
|
296
292
|
) {
|
|
297
293
|
resolver.reject(
|
|
298
|
-
|
|
294
|
+
createNativeAuthError(
|
|
299
295
|
response.result["code"],
|
|
300
296
|
response.result["description"],
|
|
301
297
|
response.result["ext"]
|
|
@@ -305,7 +301,8 @@ export class NativeMessageHandler {
|
|
|
305
301
|
resolver.resolve(response.result);
|
|
306
302
|
}
|
|
307
303
|
} else {
|
|
308
|
-
throw
|
|
304
|
+
throw createAuthError(
|
|
305
|
+
AuthErrorCodes.unexpectedError,
|
|
309
306
|
"Event does not contain result."
|
|
310
307
|
);
|
|
311
308
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Status Codes that can be thrown by WAM
|
|
7
|
+
export const USER_INTERACTION_REQUIRED = "USER_INTERACTION_REQUIRED";
|
|
8
|
+
export const USER_CANCEL = "USER_CANCEL";
|
|
9
|
+
export const NO_NETWORK = "NO_NETWORK";
|
|
10
|
+
export const TRANSIENT_ERROR = "TRANSIENT_ERROR";
|
|
11
|
+
export const PERSISTENT_ERROR = "PERSISTENT_ERROR";
|
|
12
|
+
export const DISABLED = "DISABLED";
|
|
13
|
+
export const ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE";
|
|
@@ -27,11 +27,14 @@ import {
|
|
|
27
27
|
CcsCredentialType,
|
|
28
28
|
AuthToken,
|
|
29
29
|
ValidCredentialType,
|
|
30
|
-
ClientAuthError,
|
|
31
30
|
TokenKeys,
|
|
32
31
|
CredentialType,
|
|
33
32
|
CacheRecord,
|
|
34
33
|
AuthenticationScheme,
|
|
34
|
+
createClientAuthError,
|
|
35
|
+
ClientAuthErrorCodes,
|
|
36
|
+
PerformanceEvents,
|
|
37
|
+
IPerformanceClient,
|
|
35
38
|
} from "@azure/msal-common";
|
|
36
39
|
import { CacheOptions } from "../config/Configuration";
|
|
37
40
|
import {
|
|
@@ -614,7 +617,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
614
617
|
this.logger.error(
|
|
615
618
|
`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${type}`
|
|
616
619
|
);
|
|
617
|
-
|
|
620
|
+
throw createClientAuthError(
|
|
621
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
622
|
+
);
|
|
618
623
|
}
|
|
619
624
|
|
|
620
625
|
this.setItem(
|
|
@@ -685,7 +690,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
685
690
|
this.logger.error(
|
|
686
691
|
`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${type}`
|
|
687
692
|
);
|
|
688
|
-
|
|
693
|
+
throw createClientAuthError(
|
|
694
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
695
|
+
);
|
|
689
696
|
}
|
|
690
697
|
|
|
691
698
|
this.setItem(
|
|
@@ -1171,7 +1178,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1171
1178
|
if (matchingAccounts.length === 1) {
|
|
1172
1179
|
return matchingAccounts[0];
|
|
1173
1180
|
} else if (matchingAccounts.length > 1) {
|
|
1174
|
-
throw
|
|
1181
|
+
throw createClientAuthError(
|
|
1182
|
+
ClientAuthErrorCodes.multipleMatchingAccounts
|
|
1183
|
+
);
|
|
1175
1184
|
}
|
|
1176
1185
|
|
|
1177
1186
|
return null;
|
|
@@ -1353,10 +1362,16 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1353
1362
|
|
|
1354
1363
|
/**
|
|
1355
1364
|
* Clears all access tokes that have claims prior to saving the current one
|
|
1356
|
-
* @param
|
|
1365
|
+
* @param performanceClient {IPerformanceClient}
|
|
1357
1366
|
* @returns
|
|
1358
1367
|
*/
|
|
1359
|
-
async clearTokensAndKeysWithClaims(
|
|
1368
|
+
async clearTokensAndKeysWithClaims(
|
|
1369
|
+
performanceClient: IPerformanceClient
|
|
1370
|
+
): Promise<void> {
|
|
1371
|
+
performanceClient.addQueueMeasurement(
|
|
1372
|
+
PerformanceEvents.ClearTokensAndKeysWithClaims
|
|
1373
|
+
);
|
|
1374
|
+
|
|
1360
1375
|
const tokenKeys = this.getTokenKeys();
|
|
1361
1376
|
|
|
1362
1377
|
const removedAccessTokens: Array<Promise<void>> = [];
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
BrowserConfigurationAuthErrorCodes,
|
|
8
|
+
createBrowserConfigurationAuthError,
|
|
9
|
+
} from "../error/BrowserConfigurationAuthError";
|
|
7
10
|
import { BrowserCacheLocation } from "../utils/BrowserConstants";
|
|
8
11
|
import { IWindowStorage } from "./IWindowStorage";
|
|
9
12
|
|
|
@@ -17,17 +20,12 @@ export class BrowserStorage implements IWindowStorage<string> {
|
|
|
17
20
|
|
|
18
21
|
private validateWindowStorage(cacheLocation: string): void {
|
|
19
22
|
if (
|
|
20
|
-
cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
21
|
-
|
|
23
|
+
(cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
24
|
+
cacheLocation !== BrowserCacheLocation.SessionStorage) ||
|
|
25
|
+
!window[cacheLocation]
|
|
22
26
|
) {
|
|
23
|
-
throw
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
const storageSupported = !!window[cacheLocation];
|
|
28
|
-
if (!storageSupported) {
|
|
29
|
-
throw BrowserConfigurationAuthError.createStorageNotSupportedError(
|
|
30
|
-
cacheLocation
|
|
27
|
+
throw createBrowserConfigurationAuthError(
|
|
28
|
+
BrowserConfigurationAuthErrorCodes.storageNotSupported
|
|
31
29
|
);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
@@ -17,9 +17,11 @@ import {
|
|
|
17
17
|
AzureCloudInstance,
|
|
18
18
|
AzureCloudOptions,
|
|
19
19
|
ApplicationTelemetry,
|
|
20
|
-
|
|
20
|
+
createClientConfigurationError,
|
|
21
|
+
ClientConfigurationErrorCodes,
|
|
21
22
|
IPerformanceClient,
|
|
22
23
|
StubPerformanceClient,
|
|
24
|
+
Logger,
|
|
23
25
|
} from "@azure/msal-common";
|
|
24
26
|
import {
|
|
25
27
|
BrowserCacheLocation,
|
|
@@ -323,7 +325,8 @@ export function buildConfiguration(
|
|
|
323
325
|
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS,
|
|
324
326
|
};
|
|
325
327
|
|
|
326
|
-
const providedSystemOptions: BrowserSystemOptions = {
|
|
328
|
+
const providedSystemOptions: Required<BrowserSystemOptions> = {
|
|
329
|
+
...DEFAULT_BROWSER_SYSTEM_OPTIONS,
|
|
327
330
|
...userInputSystem,
|
|
328
331
|
loggerOptions: userInputSystem?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
329
332
|
};
|
|
@@ -341,10 +344,13 @@ export function buildConfiguration(
|
|
|
341
344
|
userInputAuth?.protocolMode !== ProtocolMode.OIDC &&
|
|
342
345
|
userInputAuth?.OIDCOptions
|
|
343
346
|
) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
const logger = new Logger(providedSystemOptions.loggerOptions);
|
|
348
|
+
logger.warning(
|
|
349
|
+
JSON.stringify(
|
|
350
|
+
createClientConfigurationError(
|
|
351
|
+
ClientConfigurationErrorCodes.cannotSetOIDCOptions
|
|
352
|
+
)
|
|
353
|
+
)
|
|
348
354
|
);
|
|
349
355
|
}
|
|
350
356
|
|
|
@@ -354,7 +360,9 @@ export function buildConfiguration(
|
|
|
354
360
|
userInputAuth.protocolMode !== ProtocolMode.AAD &&
|
|
355
361
|
providedSystemOptions?.allowNativeBroker
|
|
356
362
|
) {
|
|
357
|
-
throw
|
|
363
|
+
throw createClientConfigurationError(
|
|
364
|
+
ClientConfigurationErrorCodes.cannotAllowNativeBroker
|
|
365
|
+
);
|
|
358
366
|
}
|
|
359
367
|
|
|
360
368
|
const overlayedConfig: BrowserConfiguration = {
|
|
@@ -367,7 +375,7 @@ export function buildConfiguration(
|
|
|
367
375
|
},
|
|
368
376
|
},
|
|
369
377
|
cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },
|
|
370
|
-
system:
|
|
378
|
+
system: providedSystemOptions,
|
|
371
379
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
|
|
372
380
|
};
|
|
373
381
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
PerformanceCallbackFunction,
|
|
10
10
|
IPerformanceClient,
|
|
11
11
|
CommonSilentFlowRequest,
|
|
12
|
+
AccountFilter,
|
|
12
13
|
} from "@azure/msal-common";
|
|
13
14
|
import { RedirectRequest } from "../request/RedirectRequest";
|
|
14
15
|
import { PopupRequest } from "../request/PopupRequest";
|
|
@@ -64,13 +65,15 @@ export interface IController {
|
|
|
64
65
|
|
|
65
66
|
disableAccountStorageEvents(): void;
|
|
66
67
|
|
|
68
|
+
getAccount(accountFilter: AccountFilter): AccountInfo | null;
|
|
69
|
+
|
|
67
70
|
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
|
|
68
71
|
|
|
69
72
|
getAccountByLocalId(localId: string): AccountInfo | null;
|
|
70
73
|
|
|
71
74
|
getAccountByUsername(userName: string): AccountInfo | null;
|
|
72
75
|
|
|
73
|
-
getAllAccounts(): AccountInfo[];
|
|
76
|
+
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[];
|
|
74
77
|
|
|
75
78
|
handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;
|
|
76
79
|
|