@azure/msal-browser
Advanced tools
Comparing version 2.16.1 to 2.17.0
@@ -5,2 +5,111 @@ { | ||
{ | ||
"date": "Tue, 07 Sep 2021 23:22:24 GMT", | ||
"tag": "@azure/msal-browser_v2.17.0", | ||
"version": "2.17.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Add configuration for popup window size and placement #3946", | ||
"author": "joarroyo@microsoft.com", | ||
"commit": "aefe791ee660bbb6bf7df789b5cfb77b46887e05", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Add API to sideload tokens to msal-browser #3895", | ||
"author": "joarroyo@microsoft.com", | ||
"commit": "cef2629499cf997f9167fe3ecc7628cf32513dfc", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Add SignedHttpRequest class #3058", | ||
"author": "janutter@microsoft.com", | ||
"commit": "19fe65ef6562deeae0778db5030f44fa6e24aa5d", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Refactor acquireToken logic into InteractionClients #3871", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "8ac64949f23346cdbdac6f8a2f6c8293d016ee32", | ||
"package": "@azure/msal-browser" | ||
} | ||
], | ||
"patch": [ | ||
{ | ||
"comment": "Clear cache before constructing logout url #3982", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "9e4d8a161cd8eac51ea7ded5dadc2b6ff028f5d7", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Add pop params to request thumbprint #3973", | ||
"author": "hemoral@microsoft.com", | ||
"commit": "b3b18bc86a5949905be265c9b892e288551ac894", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Update ADAL to MSAL SSO logic to use preferred_username instead of upn by default #3945", | ||
"author": "ellymakuba@microsoft.com", | ||
"commit": "0eb77a9e467f0074bb9ee5bf52d7c2dfa6f7efad", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Populate msal v2 loginHint from cached msal v1 id token #4027", | ||
"author": "janutter@microsoft.com", | ||
"commit": "de24de1d3a135c106143a6cc9907cc1264f546e0", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Throw interaction in progress if any msal instance has interaction in progress #4014", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "5188d7d9fb2aa7a9e9f2ffd12abd8d438c4c3876", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Only emit handleRedirect start event on first invocation of handleRedirectPromise #4013", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "09f8cece289c07dd9c5681a31ec285e4111db4ae", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Add correlationId to AuthenticationResult type #3947", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "931061695df57488a26397763bbdb3e466713df8", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Remove token binding key from key store when refreshing pop token #3500", | ||
"author": "hemoral@microsoft.com", | ||
"commit": "6592652877f31405c8ed73a66f03eada90a78c0a", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Fix clearing active account on logout #3948", | ||
"author": "hemoral@microsoft.com", | ||
"commit": "cd45c77348f6fc259f9378f69b25569146e1c58a", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Add correlationId to errors thrown #3930", | ||
"author": "thomas.norling@microsoft.com", | ||
"commit": "c2d19c27d11fdab54fb336b9a455b05c753ae750", | ||
"package": "@azure/msal-browser" | ||
} | ||
], | ||
"none": [ | ||
{ | ||
"comment": "Fix accesstoken_with_authscheme implementation #3910", | ||
"author": "hemoral@microsoft.com", | ||
"commit": "9aceb4219ebad900277aa6a59ca1ff93c5a21e0a", | ||
"package": "@azure/msal-browser" | ||
}, | ||
{ | ||
"comment": "Update FAQ #3934", | ||
"author": "joliuac@gmail.com", | ||
"commit": "323d7eabbbd95c499d2c2a2446cdea4531af71c5", | ||
"package": "@azure/msal-browser" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 22 Jul 2021 22:50:22 GMT", | ||
@@ -7,0 +116,0 @@ "tag": "@azure/msal-browser_v2.16.0", |
# Change Log - @azure/msal-browser | ||
This log was last generated on Thu, 22 Jul 2021 22:50:22 GMT and should not be manually modified. | ||
This log was last generated on Tue, 07 Sep 2021 23:22:24 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 2.17.0 | ||
Tue, 07 Sep 2021 23:22:24 GMT | ||
### Minor changes | ||
- Add configuration for popup window size and placement #3946 (joarroyo@microsoft.com) | ||
- Add API to sideload tokens to msal-browser #3895 (joarroyo@microsoft.com) | ||
- Add SignedHttpRequest class #3058 (janutter@microsoft.com) | ||
- Refactor acquireToken logic into InteractionClients #3871 (thomas.norling@microsoft.com) | ||
### Patches | ||
- Clear cache before constructing logout url #3982 (thomas.norling@microsoft.com) | ||
- Add pop params to request thumbprint #3973 (hemoral@microsoft.com) | ||
- Update ADAL to MSAL SSO logic to use preferred_username instead of upn by default #3945 (ellymakuba@microsoft.com) | ||
- Populate msal v2 loginHint from cached msal v1 id token #4027 (janutter@microsoft.com) | ||
- Throw interaction in progress if any msal instance has interaction in progress #4014 (thomas.norling@microsoft.com) | ||
- Only emit handleRedirect start event on first invocation of handleRedirectPromise #4013 (thomas.norling@microsoft.com) | ||
- Add correlationId to AuthenticationResult type #3947 (thomas.norling@microsoft.com) | ||
- Remove token binding key from key store when refreshing pop token #3500 (hemoral@microsoft.com) | ||
- Fix clearing active account on logout #3948 (hemoral@microsoft.com) | ||
- Add correlationId to errors thrown #3930 (thomas.norling@microsoft.com) | ||
## 2.16.0 | ||
@@ -8,0 +32,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /*! ***************************************************************************** |
@@ -1,2 +0,2 @@ | ||
import { Authority, CommonAuthorizationCodeRequest, AuthorizationCodeClient, AccountInfo, ServerTelemetryManager, SilentFlowClient, ClientConfiguration, BaseAuthRequest, INetworkModule, AuthenticationResult, Logger, RefreshTokenClient, CommonSilentFlowRequest, CommonEndSessionRequest, ICrypto } from "@azure/msal-common"; | ||
import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto } from "@azure/msal-common"; | ||
import { BrowserCacheManager } from "../cache/BrowserCacheManager"; | ||
@@ -7,3 +7,2 @@ import { BrowserConfiguration, Configuration } from "../config/Configuration"; | ||
import { PopupRequest } from "../request/PopupRequest"; | ||
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest"; | ||
import { SsoSilentRequest } from "../request/SsoSilentRequest"; | ||
@@ -15,2 +14,3 @@ import { EventCallbackFunction } from "../event/EventMessage"; | ||
import { EventHandler } from "../event/EventHandler"; | ||
import { ITokenCache } from "../cache/ITokenCache"; | ||
export declare abstract class ClientApplication { | ||
@@ -22,6 +22,5 @@ protected readonly browserCrypto: ICrypto; | ||
protected config: BrowserConfiguration; | ||
private tokenCache; | ||
protected logger: Logger; | ||
protected isBrowserEnvironment: boolean; | ||
private wrapperSKU; | ||
private wrapperVer; | ||
protected eventHandler: EventHandler; | ||
@@ -60,26 +59,2 @@ private redirectResponse; | ||
/** | ||
* Checks if navigateToLoginRequestUrl is set, and: | ||
* - if true, performs logic to cache and navigate | ||
* - if false, handles hash string and parses response | ||
* @param hash | ||
*/ | ||
private handleRedirectResponse; | ||
/** | ||
* Gets the response hash for a redirect request | ||
* Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties | ||
* @param hash | ||
*/ | ||
private getRedirectResponseHash; | ||
/** | ||
* @param hash | ||
* @param interactionType | ||
*/ | ||
private validateAndExtractStateFromHash; | ||
/** | ||
* Checks if hash exists and handles in window. | ||
* @param hash | ||
* @param state | ||
*/ | ||
private handleHash; | ||
/** | ||
* Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects | ||
@@ -103,11 +78,2 @@ * the page, so any code that follows this function will not execute. | ||
/** | ||
* Helper which obtains an access_token for your API via opening a popup window in the user's browser | ||
* @param validRequest | ||
* @param popupName | ||
* @param popup | ||
* | ||
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised. | ||
*/ | ||
private acquireTokenPopupAsync; | ||
/** | ||
* This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work: | ||
@@ -129,8 +95,2 @@ * - Any browser using a form of Intelligent Tracking Prevention | ||
/** | ||
* This function uses a hidden iframe to fetch an authorization code from the eSTS. To be used for silent refresh token acquisition and renewal. | ||
* @param request | ||
* @param apiId - ApiId of the calling function. Used for telemetry. | ||
*/ | ||
private acquireTokenByIframe; | ||
/** | ||
* Use this function to obtain a token before every call to the API / resource provider | ||
@@ -148,9 +108,2 @@ * | ||
/** | ||
* Helper which acquires an authorization code silently using a hidden iframe from given url | ||
* using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens. | ||
* @param navigateUrl | ||
* @param userRequestScopes | ||
*/ | ||
private silentTokenHelper; | ||
/** | ||
* Deprecated logout function. Use logoutRedirect or logoutPopup instead | ||
@@ -173,10 +126,2 @@ * @param logoutRequest | ||
/** | ||
* | ||
* @param request | ||
* @param popupName | ||
* @param requestAuthority | ||
* @param popup | ||
*/ | ||
private logoutPopupAsync; | ||
/** | ||
* Returns all accounts that MSAL currently has data for. | ||
@@ -223,56 +168,2 @@ * (the account object is created at the time of successful login) | ||
/** | ||
* | ||
* Use to get the redirect uri configured in MSAL or null. | ||
* @param requestRedirectUri | ||
* @returns Redirect URL | ||
* | ||
*/ | ||
protected getRedirectUri(requestRedirectUri?: string): string; | ||
/** | ||
* Use to get the redirectStartPage either from request or use current window | ||
* @param requestStartPage | ||
*/ | ||
protected getRedirectStartPage(requestStartPage?: string): string; | ||
/** | ||
* Used to get a discovered version of the default authority. | ||
* @param requestAuthority | ||
* @param requestCorrelationId | ||
*/ | ||
getDiscoveredAuthority(requestAuthority?: string, requestCorrelationId?: string): Promise<Authority>; | ||
/** | ||
* Helper to check whether interaction is in progress. | ||
*/ | ||
protected interactionInProgress(): boolean; | ||
/** | ||
* Creates an Authorization Code Client with the given authority, or the default authority. | ||
* @param serverTelemetryManager | ||
* @param authorityUrl | ||
*/ | ||
protected createAuthCodeClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, correlationId?: string): Promise<AuthorizationCodeClient>; | ||
/** | ||
* Creates an Silent Flow Client with the given authority, or the default authority. | ||
* @param serverTelemetryManager | ||
* @param authorityUrl | ||
*/ | ||
protected createSilentFlowClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, correlationId?: string): Promise<SilentFlowClient>; | ||
/** | ||
* Creates a Refresh Client with the given authority, or the default authority. | ||
* @param serverTelemetryManager | ||
* @param authorityUrl | ||
*/ | ||
protected createRefreshTokenClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, correlationId?: string): Promise<RefreshTokenClient>; | ||
/** | ||
* Creates a Client Configuration object with the given request authority, or the default authority. | ||
* @param serverTelemetryManager | ||
* @param requestAuthority | ||
* @param requestCorrelationId | ||
*/ | ||
protected getClientConfiguration(serverTelemetryManager: ServerTelemetryManager, requestAuthority?: string, requestCorrelationId?: string): Promise<ClientConfiguration>; | ||
/** | ||
* Helper to validate app environment before making a request. | ||
* @param request | ||
* @param interactionType | ||
*/ | ||
protected preflightInteractiveRequest(request: RedirectRequest | PopupRequest, interactionType: InteractionType): AuthorizationUrlRequest; | ||
/** | ||
* Helper to validate app environment before making an auth request | ||
@@ -283,30 +174,2 @@ * * @param interactionType | ||
/** | ||
* Initializer function for all request APIs | ||
* @param request | ||
*/ | ||
protected initializeBaseRequest(request: Partial<BaseAuthRequest>): BaseAuthRequest; | ||
/** | ||
* | ||
* @param apiId | ||
* @param correlationId | ||
* @param forceRefresh | ||
*/ | ||
protected initializeServerTelemetryManager(apiId: number, correlationId: string, forceRefresh?: boolean): ServerTelemetryManager; | ||
/** | ||
* Helper to initialize required request parameters for interactive APIs and ssoSilent() | ||
* @param request | ||
* @param interactionType | ||
*/ | ||
protected initializeAuthorizationRequest(request: RedirectRequest | PopupRequest | SsoSilentRequest, interactionType: InteractionType): AuthorizationUrlRequest; | ||
/** | ||
* Generates an auth code request tied to the url request. | ||
* @param request | ||
*/ | ||
protected initializeAuthorizationCodeRequest(request: AuthorizationUrlRequest): Promise<CommonAuthorizationCodeRequest>; | ||
/** | ||
* Initializer for the logout request. | ||
* @param logoutRequest | ||
*/ | ||
protected initializeLogoutRequest(logoutRequest?: EndSessionRequest): CommonEndSessionRequest; | ||
/** | ||
* Adds event callbacks to array | ||
@@ -322,2 +185,6 @@ * @param callback | ||
/** | ||
* Gets the token cache for the application. | ||
*/ | ||
getTokenCache(): ITokenCache; | ||
/** | ||
* Returns the logger instance | ||
@@ -324,0 +191,0 @@ */ |
@@ -10,2 +10,3 @@ import { AuthenticationResult, AccountInfo, Logger } from "@azure/msal-common"; | ||
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest"; | ||
import { ITokenCache } from "../cache/ITokenCache"; | ||
export interface IPublicClientApplication { | ||
@@ -28,2 +29,3 @@ acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>; | ||
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>; | ||
getTokenCache(): ITokenCache; | ||
getLogger(): Logger; | ||
@@ -30,0 +32,0 @@ setLogger(logger: Logger): void; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -58,2 +58,5 @@ import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js'; | ||
}, | ||
getTokenCache: function () { | ||
throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError(); | ||
}, | ||
getLogger: function () { | ||
@@ -60,0 +63,0 @@ throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError(); |
@@ -1,9 +0,9 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js'; | ||
import { DEFAULT_REQUEST, InteractionType, ApiId } from '../utils/BrowserConstants.js'; | ||
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js'; | ||
import { DEFAULT_REQUEST, InteractionType } from '../utils/BrowserConstants.js'; | ||
import { ClientApplication } from './ClientApplication.js'; | ||
import { EventType } from '../event/EventType.js'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
import { name, version } from '../packageMetadata.js'; | ||
import { SilentCacheClient } from '../interaction_client/SilentCacheClient.js'; | ||
@@ -95,3 +95,7 @@ /* | ||
scopes: request.scopes, | ||
homeAccountIdentifier: account.homeAccountId | ||
homeAccountIdentifier: account.homeAccountId, | ||
authenticationScheme: request.authenticationScheme, | ||
resourceRequestMethod: request.resourceRequestMethod, | ||
resourceRequestUri: request.resourceRequestUri, | ||
shrClaims: request.shrClaims | ||
}; | ||
@@ -129,39 +133,27 @@ silentRequestKey = JSON.stringify(thumbprint); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var silentRequest, browserRequestLogger, serverTelemetryManager, silentAuthClient, cachedToken, tokenRenewalResult, tokenRenewalError_1; | ||
var silentCacheClient, silentRequest; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
silentRequest = __assign(__assign(__assign({}, request), this.initializeBaseRequest(request)), { account: account, forceRefresh: request.forceRefresh || false }); | ||
browserRequestLogger = this.logger.clone(name, version, silentRequest.correlationId); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 9]); | ||
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow, silentRequest.correlationId); | ||
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.correlationId)]; | ||
case 2: | ||
silentAuthClient = _a.sent(); | ||
browserRequestLogger.verbose("Silent auth client created"); | ||
return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)]; | ||
case 3: | ||
cachedToken = _a.sent(); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, cachedToken); | ||
return [2 /*return*/, cachedToken]; | ||
case 4: | ||
_a.sent(); | ||
_a.label = 5; | ||
case 5: | ||
_a.trys.push([5, 7, , 8]); | ||
return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)]; | ||
case 6: | ||
tokenRenewalResult = _a.sent(); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult); | ||
return [2 /*return*/, tokenRenewalResult]; | ||
case 7: | ||
tokenRenewalError_1 = _a.sent(); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1); | ||
throw tokenRenewalError_1; | ||
case 8: return [3 /*break*/, 9]; | ||
case 9: return [2 /*return*/]; | ||
} | ||
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient); | ||
silentRequest = silentCacheClient.initializeSilentRequest(request, account); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request); | ||
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var tokenRenewalResult, tokenRenewalError_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)]; | ||
case 1: | ||
tokenRenewalResult = _a.sent(); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult); | ||
return [2 /*return*/, tokenRenewalResult]; | ||
case 2: | ||
tokenRenewalError_1 = _a.sent(); | ||
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1); | ||
throw tokenRenewalError_1; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
}); | ||
@@ -168,0 +160,0 @@ }); |
@@ -126,2 +126,12 @@ import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo } from "@azure/msal-common"; | ||
/** | ||
* Sets wrapper metadata in memory | ||
* @param wrapperSKU | ||
* @param wrapperVersion | ||
*/ | ||
setWrapperMetadata(wrapperSKU: string, wrapperVersion: string): void; | ||
/** | ||
* Returns wrapper metadata from in-memory storage | ||
*/ | ||
getWrapperMetadata(): [string, string]; | ||
/** | ||
* | ||
@@ -186,5 +196,5 @@ * @param entity | ||
/** | ||
* Clears all cache entries created by MSAL (except tokens). | ||
* Clears all cache entries created by MSAL. | ||
*/ | ||
clear(): void; | ||
clear(): Promise<void>; | ||
/** | ||
@@ -276,4 +286,7 @@ * Add value to cookies | ||
getCachedRequest(state: string, browserCrypto: ICrypto): CommonAuthorizationCodeRequest; | ||
isInteractionInProgress(matchClientId?: boolean): boolean; | ||
getInteractionInProgress(): string | null; | ||
setInteractionInProgress(inProgress: boolean): void; | ||
} | ||
export declare const DEFAULT_BROWSER_CACHE_MANAGER: (clientId: string, logger: Logger) => BrowserCacheManager; | ||
//# sourceMappingURL=BrowserCacheManager.d.ts.map |
@@ -1,7 +0,7 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
import { __extends, __spread } from '../_virtual/_tslib.js'; | ||
import { __extends, __spread, __awaiter, __generator } from '../_virtual/_tslib.js'; | ||
import { DEFAULT_CRYPTO_IMPLEMENTATION, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, PersistentCacheKeys, ThrottlingEntity, Constants, StringUtils, ProtocolUtils, CcsCredentialType } from '@azure/msal-common'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
import { BrowserCacheLocation, TemporaryCacheKeys } from '../utils/BrowserConstants.js'; | ||
import { BrowserCacheLocation, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js'; | ||
import { BrowserStorage } from './BrowserStorage.js'; | ||
@@ -326,2 +326,19 @@ import { MemoryStorage } from './MemoryStorage.js'; | ||
/** | ||
* Sets wrapper metadata in memory | ||
* @param wrapperSKU | ||
* @param wrapperVersion | ||
*/ | ||
BrowserCacheManager.prototype.setWrapperMetadata = function (wrapperSKU, wrapperVersion) { | ||
this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_SKU, wrapperSKU); | ||
this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_VER, wrapperVersion); | ||
}; | ||
/** | ||
* Returns wrapper metadata from in-memory storage | ||
*/ | ||
BrowserCacheManager.prototype.getWrapperMetadata = function () { | ||
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) || ""; | ||
var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) || ""; | ||
return [sku, version]; | ||
}; | ||
/** | ||
* | ||
@@ -485,15 +502,28 @@ * @param entity | ||
/** | ||
* Clears all cache entries created by MSAL (except tokens). | ||
* Clears all cache entries created by MSAL. | ||
*/ | ||
BrowserCacheManager.prototype.clear = function () { | ||
var _this = this; | ||
this.removeAllAccounts(); | ||
this.removeAppMetadata(); | ||
this.getKeys().forEach(function (cacheKey) { | ||
// Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js | ||
if ((_this.browserStorage.containsKey(cacheKey) || _this.temporaryCacheStorage.containsKey(cacheKey)) && ((cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1) || (cacheKey.indexOf(_this.clientId) !== -1))) { | ||
_this.removeItem(cacheKey); | ||
} | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
// Removes all accounts and their credentials | ||
return [4 /*yield*/, this.removeAllAccounts()]; | ||
case 1: | ||
// Removes all accounts and their credentials | ||
_a.sent(); | ||
this.removeAppMetadata(); | ||
// Removes all remaining MSAL cache items | ||
this.getKeys().forEach(function (cacheKey) { | ||
// Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js | ||
if ((_this.browserStorage.containsKey(cacheKey) || _this.temporaryCacheStorage.containsKey(cacheKey)) && ((cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1) || (cacheKey.indexOf(_this.clientId) !== -1))) { | ||
_this.removeItem(cacheKey); | ||
} | ||
}); | ||
this.internalStorage.clear(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
this.internalStorage.clear(); | ||
}; | ||
@@ -688,4 +718,5 @@ /** | ||
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH)); | ||
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY)); | ||
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID)); | ||
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL)); | ||
this.setInteractionInProgress(false); | ||
}; | ||
@@ -766,2 +797,27 @@ /** | ||
}; | ||
BrowserCacheManager.prototype.isInteractionInProgress = function (matchClientId) { | ||
var clientId = this.getInteractionInProgress(); | ||
if (matchClientId) { | ||
return clientId === this.clientId; | ||
} | ||
else { | ||
return !!clientId; | ||
} | ||
}; | ||
BrowserCacheManager.prototype.getInteractionInProgress = function () { | ||
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY; | ||
return this.getTemporaryCache(key, false); | ||
}; | ||
BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) { | ||
var clientId = this.getInteractionInProgress(); | ||
// Ensure we don't overwrite interaction in progress for a different clientId | ||
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY; | ||
if (inProgress && !clientId) { | ||
// No interaction is in progress | ||
this.setTemporaryCache(key, this.clientId, false); | ||
} | ||
else if (!inProgress && clientId === this.clientId) { | ||
this.removeItem(key); | ||
} | ||
}; | ||
return BrowserCacheManager; | ||
@@ -768,0 +824,0 @@ }(CacheManager)); |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js'; |
@@ -26,3 +26,9 @@ /** | ||
put(key: string, payload: T): Promise<T>; | ||
/** | ||
* Removes item from IndexedDB under given key | ||
* @param key | ||
*/ | ||
delete(key: string): Promise<boolean>; | ||
clear(): Promise<boolean>; | ||
} | ||
//# sourceMappingURL=DatabaseStorage.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -112,2 +112,62 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; | ||
}; | ||
/** | ||
* Removes item from IndexedDB under given key | ||
* @param key | ||
*/ | ||
DatabaseStorage.prototype.delete = function (key) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!!this.dbOpen) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.open()]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, new Promise(function (resolve, reject) { | ||
if (!_this.db) { | ||
return reject(BrowserAuthError.createDatabaseNotOpenError()); | ||
} | ||
var transaction = _this.db.transaction([_this.tableName], "readwrite"); | ||
var objectStore = transaction.objectStore(_this.tableName); | ||
var dbDelete = objectStore.delete(key); | ||
dbDelete.addEventListener("success", function (e) { | ||
var event = e; | ||
resolve(event.target.result === undefined); | ||
}); | ||
dbDelete.addEventListener("error", function (e) { return reject(e); }); | ||
})]; | ||
} | ||
}); | ||
}); | ||
}; | ||
DatabaseStorage.prototype.clear = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!!this.dbOpen) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.open()]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, new Promise(function (resolve, reject) { | ||
if (!_this.db) { | ||
return reject(BrowserAuthError.createDatabaseNotOpenError()); | ||
} | ||
var transaction = _this.db.transaction([_this.tableName], "readwrite"); | ||
var objectStore = transaction.objectStore(_this.tableName); | ||
var dbDelete = objectStore.clear(); | ||
dbDelete.addEventListener("success", function (e) { | ||
var event = e; | ||
resolve(event.target.result === undefined); | ||
}); | ||
dbDelete.addEventListener("error", function (e) { return reject(e); }); | ||
})]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return DatabaseStorage; | ||
@@ -114,0 +174,0 @@ }()); |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __assign } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
import { BaseAuthRequest, ICrypto, PkceCodes, SignedHttpRequest } from "@azure/msal-common"; | ||
import { ICrypto, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common"; | ||
export declare type CachedKeyPair = { | ||
@@ -48,4 +48,13 @@ publicKey: CryptoKey; | ||
*/ | ||
getPublicKeyThumbprint(request: BaseAuthRequest): Promise<string>; | ||
getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string>; | ||
/** | ||
* Removes cryptographic keypair from key store matching the keyId passed in | ||
* @param kid | ||
*/ | ||
removeTokenBindingKey(kid: string): Promise<boolean>; | ||
/** | ||
* Removes all cryptographic keys from IndexedDB storage | ||
*/ | ||
clearKeystore(): Promise<boolean>; | ||
/** | ||
* Signs the given object as a jwt payload with private key retrieved by given kid. | ||
@@ -52,0 +61,0 @@ * @param payload |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -12,2 +12,3 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; | ||
import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
@@ -95,8 +96,11 @@ /* | ||
// Store Keypair data in keystore | ||
this.cache.put(publicJwkHash, { | ||
privateKey: unextractablePrivateKey, | ||
publicKey: keyPair.publicKey, | ||
requestMethod: request.resourceRequestMethod, | ||
requestUri: request.resourceRequestUri | ||
}); | ||
return [4 /*yield*/, this.cache.put(publicJwkHash, { | ||
privateKey: unextractablePrivateKey, | ||
publicKey: keyPair.publicKey, | ||
requestMethod: request.resourceRequestMethod, | ||
requestUri: request.resourceRequestUri | ||
})]; | ||
case 6: | ||
// Store Keypair data in keystore | ||
_a.sent(); | ||
return [2 /*return*/, publicJwkHash]; | ||
@@ -108,2 +112,23 @@ } | ||
/** | ||
* Removes cryptographic keypair from key store matching the keyId passed in | ||
* @param kid | ||
*/ | ||
CryptoOps.prototype.removeTokenBindingKey = function (kid) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.cache.delete(kid)]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Removes all cryptographic keys from IndexedDB storage | ||
*/ | ||
CryptoOps.prototype.clearKeystore = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.cache.clear()]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Signs the given object as a jwt payload with private key retrieved by given kid. | ||
@@ -121,2 +146,5 @@ * @param payload | ||
cachedKeyPair = _a.sent(); | ||
if (!cachedKeyPair) { | ||
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid); | ||
} | ||
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)]; | ||
@@ -123,0 +151,0 @@ case 2: |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { MathUtils } from '../utils/MathUtils.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { BrowserStringUtils } from '../utils/BrowserStringUtils.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { BrowserStringUtils } from '../utils/BrowserStringUtils.js'; |
@@ -46,3 +46,3 @@ import { AuthError } from "@azure/msal-common"; | ||
}; | ||
popUpWindowError: { | ||
popupWindowError: { | ||
code: string; | ||
@@ -87,2 +87,6 @@ desc: string; | ||
}; | ||
silentLogoutUnsupportedError: { | ||
code: string; | ||
desc: string; | ||
}; | ||
noAccountError: { | ||
@@ -140,2 +144,10 @@ code: string; | ||
}; | ||
unableToLoadTokenError: { | ||
code: string; | ||
desc: string; | ||
}; | ||
signingKeyNotFoundInStorage: { | ||
code: string; | ||
desc: string; | ||
}; | ||
}; | ||
@@ -236,2 +248,6 @@ /** | ||
/** | ||
* Creates an error thrown when the logout API is called on any of the silent interaction clients | ||
*/ | ||
static createSilentLogoutUnsupportedError(): BrowserAuthError; | ||
/** | ||
* Creates an error thrown when the account object is not provided in the acquireTokenSilent API. | ||
@@ -288,3 +304,11 @@ */ | ||
static createFailedToParseNetworkResponseError(endpoint: string): BrowserAuthError; | ||
/** | ||
* Create an error thrown when the necessary information is not available to sideload tokens | ||
*/ | ||
static createUnableToLoadTokenError(errorDetail: string): BrowserAuthError; | ||
/** | ||
* Create an error thrown when the queried cryptographic key is not found in IndexedDB | ||
*/ | ||
static createSigningKeyNotFoundInStorageError(keyId: string): BrowserAuthError; | ||
} | ||
//# sourceMappingURL=BrowserAuthError.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -54,3 +54,3 @@ import { __extends } from '../_virtual/_tslib.js'; | ||
}, | ||
popUpWindowError: { | ||
popupWindowError: { | ||
code: "popup_window_error", | ||
@@ -95,2 +95,6 @@ desc: "Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser." | ||
}, | ||
silentLogoutUnsupportedError: { | ||
code: "silent_logout_unsupported", | ||
desc: "Silent logout not supported. Please call logoutRedirect or logoutPopup instead." | ||
}, | ||
noAccountError: { | ||
@@ -147,2 +151,10 @@ code: "no_account_error", | ||
desc: "Failed to parse network response. Check network trace." | ||
}, | ||
unableToLoadTokenError: { | ||
code: "unable_to_load_token", | ||
desc: "Error loading token to cache." | ||
}, | ||
signingKeyNotFoundInStorage: { | ||
code: "crypto_key_not_found", | ||
desc: "Cryptographic Key or Keypair not found in browser storage." | ||
} | ||
@@ -230,5 +242,5 @@ }; | ||
BrowserAuthError.createPopupWindowError = function (errDetail) { | ||
var errorMessage = BrowserAuthErrorMessage.popUpWindowError.desc; | ||
var errorMessage = BrowserAuthErrorMessage.popupWindowError.desc; | ||
errorMessage = !StringUtils.isEmpty(errDetail) ? errorMessage + " Details: " + errDetail : errorMessage; | ||
return new BrowserAuthError(BrowserAuthErrorMessage.popUpWindowError.code, errorMessage); | ||
return new BrowserAuthError(BrowserAuthErrorMessage.popupWindowError.code, errorMessage); | ||
}; | ||
@@ -293,2 +305,8 @@ /** | ||
/** | ||
* Creates an error thrown when the logout API is called on any of the silent interaction clients | ||
*/ | ||
BrowserAuthError.createSilentLogoutUnsupportedError = function () { | ||
return new BrowserAuthError(BrowserAuthErrorMessage.silentLogoutUnsupportedError.code, BrowserAuthErrorMessage.silentLogoutUnsupportedError.desc); | ||
}; | ||
/** | ||
* Creates an error thrown when the account object is not provided in the acquireTokenSilent API. | ||
@@ -371,2 +389,14 @@ */ | ||
}; | ||
/** | ||
* Create an error thrown when the necessary information is not available to sideload tokens | ||
*/ | ||
BrowserAuthError.createUnableToLoadTokenError = function (errorDetail) { | ||
return new BrowserAuthError(BrowserAuthErrorMessage.unableToLoadTokenError.code, BrowserAuthErrorMessage.unableToLoadTokenError.desc + " | " + errorDetail); | ||
}; | ||
/** | ||
* Create an error thrown when the queried cryptographic key is not found in IndexedDB | ||
*/ | ||
BrowserAuthError.createSigningKeyNotFoundInStorageError = function (keyId) { | ||
return new BrowserAuthError(BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code, BrowserAuthErrorMessage.signingKeyNotFoundInStorage.desc + " | No match found for KeyId: " + keyId); | ||
}; | ||
return BrowserAuthError; | ||
@@ -373,0 +403,0 @@ }(AuthError)); |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
@@ -22,5 +22,6 @@ import { AuthenticationResult, AuthError } from "@azure/msal-common"; | ||
* @param message | ||
* @param currentStatus | ||
*/ | ||
static getInteractionStatusFromEvent(message: EventMessage): InteractionStatus | null; | ||
static getInteractionStatusFromEvent(message: EventMessage, currentStatus?: InteractionStatus): InteractionStatus | null; | ||
} | ||
//# sourceMappingURL=EventMessage.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -16,4 +16,5 @@ import { EventType } from './EventType.js'; | ||
* @param message | ||
* @param currentStatus | ||
*/ | ||
EventMessageUtils.getInteractionStatusFromEvent = function (message) { | ||
EventMessageUtils.getInteractionStatusFromEvent = function (message, currentStatus) { | ||
switch (message.eventType) { | ||
@@ -33,12 +34,30 @@ case EventType.LOGIN_START: | ||
return InteractionStatus.Logout; | ||
case EventType.LOGIN_SUCCESS: | ||
case EventType.SSO_SILENT_SUCCESS: | ||
case EventType.HANDLE_REDIRECT_END: | ||
case EventType.LOGIN_FAILURE: | ||
case EventType.SSO_SILENT_FAILURE: | ||
if (currentStatus && currentStatus !== InteractionStatus.SsoSilent) { | ||
// Prevent this event from clearing any status other than ssoSilent | ||
break; | ||
} | ||
return InteractionStatus.None; | ||
case EventType.LOGOUT_END: | ||
if (currentStatus && currentStatus !== InteractionStatus.Logout) { | ||
// Prevent this event from clearing any status other than logout | ||
break; | ||
} | ||
return InteractionStatus.None; | ||
case EventType.HANDLE_REDIRECT_END: | ||
if (currentStatus && currentStatus !== InteractionStatus.HandleRedirect) { | ||
// Prevent this event from clearing any status other than handleRedirect | ||
break; | ||
} | ||
return InteractionStatus.None; | ||
case EventType.LOGIN_SUCCESS: | ||
case EventType.LOGIN_FAILURE: | ||
case EventType.ACQUIRE_TOKEN_SUCCESS: | ||
case EventType.ACQUIRE_TOKEN_FAILURE: | ||
if (message.interactionType === InteractionType.Redirect || message.interactionType === InteractionType.Popup) { | ||
if (currentStatus && currentStatus !== InteractionStatus.Login && currentStatus !== InteractionStatus.AcquireToken) { | ||
// Prevent this event from clearing any status other than login or acquireToken | ||
break; | ||
} | ||
return InteractionStatus.None; | ||
@@ -45,0 +64,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
@@ -22,5 +22,7 @@ /** | ||
export { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest"; | ||
export { LoadTokenOptions } from "./cache/TokenCache"; | ||
export { EventMessage, EventPayload, EventError, EventCallbackFunction, EventMessageUtils, PopupEvent } from "./event/EventMessage"; | ||
export { EventType } from "./event/EventType"; | ||
export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, InteractionRequiredAuthError, AuthError, AuthErrorMessage, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, StringUtils, UrlString } from "@azure/msal-common"; | ||
export { SignedHttpRequest } from "./crypto/SignedHttpRequest"; | ||
export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, InteractionRequiredAuthError, AuthError, AuthErrorMessage, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, ExternalTokenResponse, StringUtils, UrlString } from "@azure/msal-common"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -12,3 +12,4 @@ export { PublicClientApplication } from './app/PublicClientApplication.js'; | ||
export { EventType } from './event/EventType.js'; | ||
export { SignedHttpRequest } from './crypto/SignedHttpRequest.js'; | ||
export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationScheme, InteractionRequiredAuthError, LogLevel, Logger, ProtocolMode, StringUtils, UrlString } from '@azure/msal-common'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; |
import { CommonAuthorizationCodeRequest, AuthorizationCodeClient, Logger } from "@azure/msal-common"; | ||
import { InteractionHandler, InteractionParams } from "./InteractionHandler"; | ||
import { BrowserCacheManager } from "../cache/BrowserCacheManager"; | ||
import { PopupWindowAttributes } from "../utils/PopupUtils"; | ||
export declare type PopupParams = InteractionParams & { | ||
popup?: Window | null; | ||
popupName: string; | ||
popupWindowAttributes: PopupWindowAttributes; | ||
}; | ||
@@ -8,0 +10,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -7,3 +7,2 @@ import { __extends } from '../_virtual/_tslib.js'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
import { TemporaryCacheKeys, BrowserConstants } from '../utils/BrowserConstants.js'; | ||
import { PopupUtils } from '../utils/PopupUtils.js'; | ||
@@ -36,6 +35,6 @@ import { BrowserUtils } from '../utils/BrowserUtils.js'; | ||
// Set interaction status in the library. | ||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.INTERACTION_STATUS_KEY, BrowserConstants.INTERACTION_IN_PROGRESS_VALUE, true); | ||
this.browserStorage.setInteractionInProgress(true); | ||
this.browserRequestLogger.infoPii("Navigate to: " + requestUrl); | ||
// Open the popup window to requestUrl. | ||
return this.popupUtils.openPopup(requestUrl, params.popupName, params.popup); | ||
return this.popupUtils.openPopup(requestUrl, params); | ||
} | ||
@@ -42,0 +41,0 @@ else { |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -6,3 +6,3 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
import { TemporaryCacheKeys, BrowserConstants, ApiId } from '../utils/BrowserConstants.js'; | ||
import { TemporaryCacheKeys, ApiId } from '../utils/BrowserConstants.js'; | ||
import { InteractionHandler } from './InteractionHandler.js'; | ||
@@ -39,3 +39,4 @@ | ||
// Set interaction status in the library. | ||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.INTERACTION_STATUS_KEY, BrowserConstants.INTERACTION_IN_PROGRESS_VALUE, true); | ||
this.browserStorage.setInteractionInProgress(true); | ||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true); | ||
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto); | ||
@@ -94,3 +95,3 @@ this.browserRequestLogger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl); | ||
// Interaction is completed - remove interaction status. | ||
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY)); | ||
this.browserStorage.setInteractionInProgress(false); | ||
stateKey = this.browserStorage.generateStateKey(state); | ||
@@ -126,3 +127,3 @@ requestState = this.browserStorage.getTemporaryCache(stateKey); | ||
if (clientId) { | ||
ThrottlingUtils.removeThrottle(this.browserStorage, clientId, this.authCodeRequest.authority, this.authCodeRequest.scopes); | ||
ThrottlingUtils.removeThrottle(this.browserStorage, clientId, this.authCodeRequest); | ||
} | ||
@@ -129,0 +130,0 @@ return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)]; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js'; |
export declare const name = "@azure/msal-browser"; | ||
export declare const version = "2.16.1"; | ||
export declare const version = "2.17.0"; | ||
//# sourceMappingURL=packageMetadata.d.ts.map |
@@ -1,8 +0,8 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
/* eslint-disable header/header */ | ||
var name = "@azure/msal-browser"; | ||
var version = "2.16.1"; | ||
var version = "2.17.0"; | ||
export { name, version }; | ||
//# sourceMappingURL=packageMetadata.js.map |
import { CommonEndSessionRequest } from "@azure/msal-common"; | ||
import { PopupWindowAttributes } from "../utils/PopupUtils"; | ||
/** | ||
@@ -10,2 +11,3 @@ * EndSessionPopupRequest | ||
* - mainWindowRedirectUri - URI to navigate the main window to after logout is complete | ||
* - popupWindowAttributes - Optional popup window attributes. popupSize with height and width, and popupPosition with top and left can be set. | ||
*/ | ||
@@ -15,3 +17,4 @@ export declare type EndSessionPopupRequest = Partial<CommonEndSessionRequest> & { | ||
mainWindowRedirectUri?: string; | ||
popupWindowAttributes?: PopupWindowAttributes; | ||
}; | ||
//# sourceMappingURL=EndSessionPopupRequest.d.ts.map |
import { CommonAuthorizationUrlRequest } from "@azure/msal-common"; | ||
import { PopupWindowAttributes } from "../utils/PopupUtils"; | ||
/** | ||
@@ -25,6 +26,8 @@ * PopupRequest: Request object passed by user to retrieve a Code from the | ||
* - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks. | ||
* - popupWindowAttributes - Optional popup window attributes. popupSize with height and width, and popupPosition with top and left can be set. | ||
*/ | ||
export declare type PopupRequest = Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "scopes" | "codeChallenge" | "codeChallengeMethod">> & { | ||
scopes: Array<string>; | ||
popupWindowAttributes?: PopupWindowAttributes; | ||
}; | ||
//# sourceMappingURL=PopupRequest.d.ts.map |
@@ -63,5 +63,13 @@ import { PopupRequest } from "../request/PopupRequest"; | ||
INTERACTION_STATUS_KEY = "interaction.status", | ||
CCS_CREDENTIAL = "ccs.credential" | ||
CCS_CREDENTIAL = "ccs.credential", | ||
CORRELATION_ID = "request.correlationId" | ||
} | ||
/** | ||
* Cache keys stored in-memory | ||
*/ | ||
export declare enum InMemoryCacheKeys { | ||
WRAPPER_SKU = "wrapper.sku", | ||
WRAPPER_VER = "wrapper.version" | ||
} | ||
/** | ||
* API Codes for Telemetry purposes. | ||
@@ -68,0 +76,0 @@ * Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -73,4 +73,13 @@ import { OIDC_DEFAULT_SCOPES } from '@azure/msal-common'; | ||
TemporaryCacheKeys["CCS_CREDENTIAL"] = "ccs.credential"; | ||
TemporaryCacheKeys["CORRELATION_ID"] = "request.correlationId"; | ||
})(TemporaryCacheKeys || (TemporaryCacheKeys = {})); | ||
/** | ||
* Cache keys stored in-memory | ||
*/ | ||
var InMemoryCacheKeys; | ||
(function (InMemoryCacheKeys) { | ||
InMemoryCacheKeys["WRAPPER_SKU"] = "wrapper.sku"; | ||
InMemoryCacheKeys["WRAPPER_VER"] = "wrapper.version"; | ||
})(InMemoryCacheKeys || (InMemoryCacheKeys = {})); | ||
/** | ||
* API Codes for Telemetry purposes. | ||
@@ -150,3 +159,3 @@ * Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs | ||
export { ApiId, BrowserCacheLocation, BrowserConstants, DEFAULT_REQUEST, HTTP_REQUEST_TYPE, InteractionStatus, InteractionType, KEY_FORMAT_JWK, TemporaryCacheKeys, WrapperSKU }; | ||
export { ApiId, BrowserCacheLocation, BrowserConstants, DEFAULT_REQUEST, HTTP_REQUEST_TYPE, InMemoryCacheKeys, InteractionStatus, InteractionType, KEY_FORMAT_JWK, TemporaryCacheKeys, WrapperSKU }; | ||
//# sourceMappingURL=BrowserConstants.js.map |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { StringUtils, ProtocolUtils, ClientAuthError, UrlString } from '@azure/msal-common'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ import { Constants, UrlString } from '@azure/msal-common'; |
@@ -1,2 +0,2 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ /* |
import { CommonEndSessionRequest, Logger } from "@azure/msal-common"; | ||
import { BrowserCacheManager } from "../cache/BrowserCacheManager"; | ||
import { PopupParams } from "../interaction_handler/PopupHandler"; | ||
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest"; | ||
/** | ||
* Popup configurations for setting dimensions and position of popup window | ||
*/ | ||
export declare type PopupWindowAttributes = { | ||
popupSize?: PopupSize; | ||
popupPosition?: PopupPosition; | ||
}; | ||
export declare type PopupSize = { | ||
height: number; | ||
width: number; | ||
}; | ||
export declare type PopupPosition = { | ||
top: number; | ||
left: number; | ||
}; | ||
export declare class PopupUtils { | ||
@@ -18,8 +34,16 @@ private browserStorage; | ||
* @param popUpHeight | ||
* @param popupWindowAttributes | ||
* @ignore | ||
* @hidden | ||
*/ | ||
openPopup(urlNavigate: string, popupName: string, popup?: Window | null): Window; | ||
static openSizedPopup(urlNavigate: string, popupName: string): Window | null; | ||
openPopup(urlNavigate: string, popupParams: PopupParams): Window; | ||
/** | ||
* Helper function to set popup window dimensions and position | ||
* @param urlNavigate | ||
* @param popupName | ||
* @param popupWindowAttributes | ||
* @returns | ||
*/ | ||
static openSizedPopup(urlNavigate: string, popupName: string, popupWindowAttributes: PopupWindowAttributes, logger: Logger): Window | null; | ||
/** | ||
* Event callback to unload main window. | ||
@@ -26,0 +50,0 @@ */ |
@@ -1,6 +0,6 @@ | ||
/*! @azure/msal-browser v2.16.1 2021-08-02 */ | ||
/*! @azure/msal-browser v2.17.0 2021-09-08 */ | ||
'use strict'; | ||
import { StringUtils, Constants } from '@azure/msal-common'; | ||
import { BrowserAuthError } from '../error/BrowserAuthError.js'; | ||
import { TemporaryCacheKeys, BrowserConstants, InteractionType } from './BrowserConstants.js'; | ||
import { BrowserConstants, InteractionType } from './BrowserConstants.js'; | ||
@@ -27,18 +27,19 @@ /* | ||
* @param popUpHeight | ||
* @param popupWindowAttributes | ||
* @ignore | ||
* @hidden | ||
*/ | ||
PopupUtils.prototype.openPopup = function (urlNavigate, popupName, popup) { | ||
PopupUtils.prototype.openPopup = function (urlNavigate, popupParams) { | ||
try { | ||
var popupWindow = void 0; | ||
// Popup window passed in, setting url to navigate to | ||
if (popup) { | ||
popupWindow = popup; | ||
if (popupParams.popup) { | ||
popupWindow = popupParams.popup; | ||
this.logger.verbosePii("Navigating popup window to: " + urlNavigate); | ||
popupWindow.location.assign(urlNavigate); | ||
} | ||
else if (typeof popup === "undefined") { | ||
else if (typeof popupParams.popup === "undefined") { | ||
// Popup will be undefined if it was not passed in | ||
this.logger.verbosePii("Opening popup window to: " + urlNavigate); | ||
popupWindow = PopupUtils.openSizedPopup(urlNavigate, popupName); | ||
popupWindow = PopupUtils.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes, this.logger); | ||
} | ||
@@ -58,7 +59,15 @@ // Popup will be null if popups are blocked | ||
this.logger.error("error opening popup " + e.message); | ||
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY)); | ||
this.browserStorage.setInteractionInProgress(false); | ||
throw BrowserAuthError.createPopupWindowError(e.toString()); | ||
} | ||
}; | ||
PopupUtils.openSizedPopup = function (urlNavigate, popupName) { | ||
/** | ||
* Helper function to set popup window dimensions and position | ||
* @param urlNavigate | ||
* @param popupName | ||
* @param popupWindowAttributes | ||
* @returns | ||
*/ | ||
PopupUtils.openSizedPopup = function (urlNavigate, popupName, popupWindowAttributes, logger) { | ||
var _a, _b, _c, _d; | ||
/** | ||
@@ -74,7 +83,25 @@ * adding winLeft and winTop to account for dual monitor | ||
*/ | ||
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; | ||
var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | ||
var left = Math.max(0, ((width / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft); | ||
var top = Math.max(0, ((height / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop); | ||
return window.open(urlNavigate, popupName, "width=" + BrowserConstants.POPUP_WIDTH + ", height=" + BrowserConstants.POPUP_HEIGHT + ", top=" + top + ", left=" + left + ", scrollbars=yes"); | ||
var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; | ||
var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | ||
var width = (_a = popupWindowAttributes.popupSize) === null || _a === void 0 ? void 0 : _a.width; | ||
var height = (_b = popupWindowAttributes.popupSize) === null || _b === void 0 ? void 0 : _b.height; | ||
var top = (_c = popupWindowAttributes.popupPosition) === null || _c === void 0 ? void 0 : _c.top; | ||
var left = (_d = popupWindowAttributes.popupPosition) === null || _d === void 0 ? void 0 : _d.left; | ||
if (!width || width < 0 || width > winWidth) { | ||
logger.verbose("Default popup window width used. Window width not configured or invalid."); | ||
width = BrowserConstants.POPUP_WIDTH; | ||
} | ||
if (!height || height < 0 || height > winHeight) { | ||
logger.verbose("Default popup window height used. Window height not configured or invalid."); | ||
height = BrowserConstants.POPUP_HEIGHT; | ||
} | ||
if (!top || top < 0 || top > winHeight) { | ||
logger.verbose("Default popup window top position used. Window top not configured or invalid."); | ||
top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop); | ||
} | ||
if (!left || left < 0 || left > winWidth) { | ||
logger.verbose("Default popup window left position used. Window left not configured or invalid."); | ||
left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft); | ||
} | ||
return window.open(urlNavigate, popupName, "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + ", scrollbars=yes"); | ||
}; | ||
@@ -104,3 +131,3 @@ /** | ||
// Interaction is completed - remove interaction status. | ||
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY)); | ||
this.browserStorage.setInteractionInProgress(false); | ||
}; | ||
@@ -107,0 +134,0 @@ /** |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "2.16.1", | ||
"version": "2.17.0", | ||
"description": "Microsoft Authentication Library for js", | ||
@@ -88,4 +88,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@azure/msal-common": "^4.5.1" | ||
"@azure/msal-common": "^5.0.0" | ||
} | ||
} |
@@ -62,3 +62,3 @@ # Microsoft Authentication Library for JavaScript (MSAL.js) 2.0 for Browser-Based Single-Page Applications | ||
```html | ||
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.16.1/js/msal-browser.min.js"></script> | ||
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.17.0/js/msal-browser.min.js"></script> | ||
``` | ||
@@ -65,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4389048
206
36071
+ Added@azure/msal-common@5.2.0(transitive)
- Removed@azure/msal-common@4.5.1(transitive)
Updated@azure/msal-common@^5.0.0