Socket
Socket
Sign inDemoInstall

@azure/msal-browser

Package Overview
Dependencies
Maintainers
3
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-browser - npm Package Compare versions

Comparing version 3.7.1 to 3.7.2-alpha.0

9

dist/crypto/BrowserCrypto.d.ts

@@ -8,3 +8,5 @@ import { IPerformanceClient, Logger } from "@azure/msal-common";

* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
* @param dataString
* @param dataString {string} data string
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string} correlation id
*/

@@ -18,4 +20,5 @@ export declare function sha256Digest(dataString: string, performanceClient?: IPerformanceClient, correlationId?: string): Promise<ArrayBuffer>;

/**
* Creates a new random GUID
* @returns
* Creates a UUID v7 from the current timestamp.
* Implementation relies on the system clock to guarantee increasing order of generated identifiers.
* @returns {number}
*/

@@ -22,0 +25,0 @@ export declare function createNewGuid(): string;

@@ -1,2 +0,2 @@

import { ICrypto, INetworkModule, Logger, AccountInfo, BaseAuthRequest, ServerTelemetryManager, Authority, IPerformanceClient } from "@azure/msal-common";
import { ICrypto, INetworkModule, Logger, AccountInfo, BaseAuthRequest, ServerTelemetryManager, Authority, IPerformanceClient, AzureCloudOptions } from "@azure/msal-common";
import { BrowserConfiguration } from "../config/Configuration";

@@ -32,3 +32,3 @@ import { BrowserCacheManager } from "../cache/BrowserCacheManager";

*/
protected initializeBaseRequest(request: Partial<BaseAuthRequest>, account?: AccountInfo): Promise<BaseAuthRequest>;
protected initializeBaseRequest(request: Partial<BaseAuthRequest>): Promise<BaseAuthRequest>;
/**

@@ -42,3 +42,2 @@ *

getRedirectUri(requestRedirectUri?: string): string;
validateRequestAuthority(authority: string, account: AccountInfo): Promise<void>;
/**

@@ -54,5 +53,7 @@ *

* @param requestAuthority
* @param requestAzureCloudOptions
* @param account
*/
protected getDiscoveredAuthority(requestAuthority?: string): Promise<Authority>;
protected getDiscoveredAuthority(requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<Authority>;
}
//# sourceMappingURL=BaseInteractionClient.d.ts.map

@@ -22,5 +22,5 @@ import { StandardInteractionClient } from "./StandardInteractionClient";

*/
protected createSilentFlowClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions): Promise<SilentFlowClient>;
protected createSilentFlowClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<SilentFlowClient>;
initializeSilentRequest(request: SilentRequest, account: AccountInfo): Promise<CommonSilentFlowRequest>;
}
//# sourceMappingURL=SilentCacheClient.d.ts.map
import { StandardInteractionClient } from "./StandardInteractionClient";
import { CommonSilentFlowRequest, ServerTelemetryManager, RefreshTokenClient, AzureCloudOptions } from "@azure/msal-common";
import { CommonSilentFlowRequest, ServerTelemetryManager, RefreshTokenClient, AzureCloudOptions, AccountInfo } from "@azure/msal-common";
import { AuthenticationResult } from "../response/AuthenticationResult";

@@ -19,4 +19,4 @@ export declare class SilentRefreshClient extends StandardInteractionClient {

*/
protected createRefreshTokenClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions): Promise<RefreshTokenClient>;
protected createRefreshTokenClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<RefreshTokenClient>;
}
//# sourceMappingURL=SilentRefreshClient.d.ts.map

@@ -1,2 +0,2 @@

import { ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, Authority, CommonEndSessionRequest, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
import { ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, CommonEndSessionRequest, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
import { BaseInteractionClient } from "./BaseInteractionClient";

@@ -34,3 +34,3 @@ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";

*/
protected createAuthCodeClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, requestAzureCloudOptions?: AzureCloudOptions): Promise<AuthorizationCodeClient>;
protected createAuthCodeClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<AuthorizationCodeClient>;
/**

@@ -42,10 +42,4 @@ * Creates a Client Configuration object with the given request authority, or the default authority.

*/
protected getClientConfiguration(serverTelemetryManager: ServerTelemetryManager, requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions): Promise<ClientConfiguration>;
protected getClientConfiguration(serverTelemetryManager: ServerTelemetryManager, requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<ClientConfiguration>;
/**
* Used to get a discovered version of the default authority.
* @param requestAuthority
* @param requestCorrelationId
*/
protected getDiscoveredAuthority(requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions): Promise<Authority>;
/**
* Helper to initialize required request parameters for interactive APIs and ssoSilent()

@@ -52,0 +46,0 @@ * @param request

export declare const name = "@azure/msal-browser";
export declare const version = "3.7.1";
export declare const version = "3.7.2-alpha.0";
//# sourceMappingURL=packageMetadata.d.ts.map

@@ -13,3 +13,3 @@ {

},
"version": "3.7.1",
"version": "3.7.2-alpha.0",
"description": "Microsoft Authentication Library for js",

@@ -89,7 +89,7 @@ "keywords": [

"dotenv": "^8.2.0",
"eslint-config-msal": "^0.0.0",
"msal-test-utils": "^0.0.1",
"eslint-config-msal": "file:../../shared-configs/eslint-config-msal",
"fake-indexeddb": "^3.1.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"msal-test-utils": "file:../../shared-test-utils",
"prettier": "2.8.7",

@@ -106,4 +106,4 @@ "rimraf": "^3.0.0",

"dependencies": {
"@azure/msal-common": "14.6.1"
"@azure/msal-common": "14.6.2-alpha.0"
}
}

@@ -33,2 +33,6 @@ /*

const PUBLIC_EXPONENT: Uint8Array = new Uint8Array([0x01, 0x00, 0x01]);
// UUID hex digits
const UUID_CHARS = "0123456789abcdef";
// Array to store UINT32 random value
const UINT32_ARR = new Uint32Array(1);

@@ -56,3 +60,5 @@ const keygenAlgorithmOptions: RsaHashedKeyGenParams = {

* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
* @param dataString
* @param dataString {string} data string
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string} correlation id
*/

@@ -85,7 +91,54 @@ export async function sha256Digest(

/**
* Creates a new random GUID
* @returns
* Returns random Uint32 value.
* @returns {number}
*/
function getRandomUint32(): number {
window.crypto.getRandomValues(UINT32_ARR);
return UINT32_ARR[0];
}
/**
* Creates a UUID v7 from the current timestamp.
* Implementation relies on the system clock to guarantee increasing order of generated identifiers.
* @returns {number}
*/
export function createNewGuid(): string {
return window.crypto.randomUUID();
const currentTimestamp = Date.now();
const baseRand = getRandomUint32() * 0x400 + (getRandomUint32() & 0x3ff);
// Result byte array
const bytes = new Uint8Array(16);
// A 12-bit `rand_a` field value
const randA = Math.trunc(baseRand / 2 ** 30);
// The higher 30 bits of 62-bit `rand_b` field value
const randBHi = baseRand & (2 ** 30 - 1);
// The lower 32 bits of 62-bit `rand_b` field value
const randBLo = getRandomUint32();
bytes[0] = currentTimestamp / 2 ** 40;
bytes[1] = currentTimestamp / 2 ** 32;
bytes[2] = currentTimestamp / 2 ** 24;
bytes[3] = currentTimestamp / 2 ** 16;
bytes[4] = currentTimestamp / 2 ** 8;
bytes[5] = currentTimestamp;
bytes[6] = 0x70 | (randA >>> 8);
bytes[7] = randA;
bytes[8] = 0x80 | (randBHi >>> 24);
bytes[9] = randBHi >>> 16;
bytes[10] = randBHi >>> 8;
bytes[11] = randBHi;
bytes[12] = randBLo >>> 24;
bytes[13] = randBLo >>> 16;
bytes[14] = randBLo >>> 8;
bytes[15] = randBLo;
let text = "";
for (let i = 0; i < bytes.length; i++) {
text += UUID_CHARS.charAt(bytes[i] >>> 4);
text += UUID_CHARS.charAt(bytes[i] & 0xf);
if (i === 3 || i === 5 || i === 7 || i === 9) {
text += "-";
}
}
return text;
}

@@ -92,0 +145,0 @@

@@ -25,2 +25,4 @@ /*

StringUtils,
AzureCloudOptions,
invokeAsync,
} from "@azure/msal-common";

@@ -140,4 +142,3 @@ import { BrowserConfiguration } from "../config/Configuration";

protected async initializeBaseRequest(
request: Partial<BaseAuthRequest>,
account?: AccountInfo
request: Partial<BaseAuthRequest>
): Promise<BaseAuthRequest> {

@@ -150,6 +151,2 @@ this.performanceClient.addQueueMeasurement(

if (account) {
await this.validateRequestAuthority(authority, account);
}
const scopes = [...((request && request.scopes) || [])];

@@ -224,21 +221,2 @@

/*
* If authority provided in the request does not match environment/authority specified
* in the account or MSAL config, we throw an error.
*/
async validateRequestAuthority(
authority: string,
account: AccountInfo
): Promise<void> {
const discoveredAuthority = await this.getDiscoveredAuthority(
authority
);
if (!discoveredAuthority.isAlias(account.environment)) {
throw createClientConfigurationError(
ClientConfigurationErrorCodes.authorityMismatch
);
}
}
/**

@@ -273,7 +251,14 @@ *

* @param requestAuthority
* @param requestAzureCloudOptions
* @param account
*/
protected async getDiscoveredAuthority(
requestAuthority?: string
requestAuthority?: string,
requestAzureCloudOptions?: AzureCloudOptions,
account?: AccountInfo
): Promise<Authority> {
this.logger.verbose("getDiscoveredAuthority called");
this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
this.correlationId
);
const authorityOptions: AuthorityOptions = {

@@ -285,8 +270,24 @@ protocolMode: this.config.auth.protocolMode,

authorityMetadata: this.config.auth.authorityMetadata,
skipAuthorityMetadataCache:
this.config.auth.skipAuthorityMetadataCache,
};
const authority = requestAuthority || this.config.auth.authority;
this.logger.verbose(`Creating discovered authority with ${authority}`);
return AuthorityFactory.createDiscoveredInstance(
authority,
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
const userAuthority = requestAuthority
? requestAuthority
: this.config.auth.authority;
// fall back to the authority from config
const builtAuthority = Authority.generateAuthority(
userAuthority,
requestAzureCloudOptions || this.config.auth.azureCloudOptions
);
const discoveredAuthority = await invokeAsync(
AuthorityFactory.createDiscoveredInstance,
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
this.logger,
this.performanceClient,
this.correlationId
)(
builtAuthority,
this.config.system.networkClient,

@@ -299,3 +300,11 @@ this.browserStorage,

);
if (account && !discoveredAuthority.isAlias(account.environment)) {
throw createClientConfigurationError(
ClientConfigurationErrorCodes.authorityMismatch
);
}
return discoveredAuthority;
}
}

@@ -812,3 +812,8 @@ /*

if (request.account) {
await this.validateRequestAuthority(authority, request.account);
// validate authority
await this.getDiscoveredAuthority(
authority,
request.azureCloudOptions,
request.account
);
}

@@ -815,0 +820,0 @@

@@ -235,3 +235,4 @@ /*

validRequest.authority,
validRequest.azureCloudOptions
validRequest.azureCloudOptions,
validRequest.account
);

@@ -410,3 +411,8 @@

this.correlationId
)(serverTelemetryManager, requestAuthority);
)(
serverTelemetryManager,
requestAuthority,
undefined, // AzureCloudOptions
validRequest.account || undefined
);

@@ -413,0 +419,0 @@ try {

@@ -139,3 +139,4 @@ /*

validRequest.authority,
validRequest.azureCloudOptions
validRequest.azureCloudOptions,
validRequest.account
);

@@ -524,3 +525,8 @@

this.correlationId
)(serverTelemetryManager, logoutRequest && logoutRequest.authority);
)(
serverTelemetryManager,
logoutRequest && logoutRequest.authority,
undefined, // AzureCloudOptions
(logoutRequest && logoutRequest.account) || undefined
);

@@ -527,0 +533,0 @@ if (authClient.authority.protocolMode === ProtocolMode.OIDC) {

@@ -102,3 +102,8 @@ /*

request.correlationId
)(serverTelemetryManager, silentRequest.authority);
)(
serverTelemetryManager,
silentRequest.authority,
silentRequest.azureCloudOptions,
silentRequest.account
);
const authClient: HybridSpaAuthorizationCodeClient =

@@ -105,0 +110,0 @@ new HybridSpaAuthorizationCodeClient(clientConfig);

@@ -45,3 +45,4 @@ /*

silentRequest.authority,
silentRequest.azureCloudOptions
silentRequest.azureCloudOptions,
silentRequest.account
);

@@ -98,3 +99,4 @@ this.logger.verbose("Silent auth client created");

authorityUrl?: string,
azureCloudOptions?: AzureCloudOptions
azureCloudOptions?: AzureCloudOptions,
account?: AccountInfo
): Promise<SilentFlowClient> {

@@ -108,3 +110,3 @@ // Create auth module.

this.correlationId
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
return new SilentFlowClient(clientConfig, this.performanceClient);

@@ -128,3 +130,3 @@ }

this.correlationId
)(request, account);
)(request);
return {

@@ -131,0 +133,0 @@ ...request,

@@ -138,3 +138,4 @@ /*

silentRequest.authority,
silentRequest.azureCloudOptions
silentRequest.azureCloudOptions,
silentRequest.account
);

@@ -141,0 +142,0 @@

@@ -15,2 +15,3 @@ /*

invokeAsync,
AccountInfo,
} from "@azure/msal-common";

@@ -43,3 +44,3 @@ import { ApiId } from "../utils/BrowserConstants";

request.correlationId
)(request, request.account);
)(request);
const silentRequest: CommonSilentFlowRequest = {

@@ -64,3 +65,4 @@ ...request,

silentRequest.authority,
silentRequest.azureCloudOptions
silentRequest.azureCloudOptions,
silentRequest.account
);

@@ -103,3 +105,4 @@ // Send request to renew token. Auth module will throw errors if token cannot be renewed.

authorityUrl?: string,
azureCloudOptions?: AzureCloudOptions
azureCloudOptions?: AzureCloudOptions,
account?: AccountInfo
): Promise<RefreshTokenClient> {

@@ -113,5 +116,5 @@ // Create auth module.

this.correlationId
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
return new RefreshTokenClient(clientConfig, this.performanceClient);
}
}

@@ -12,5 +12,2 @@ /*

ClientConfiguration,
AuthorityOptions,
Authority,
AuthorityFactory,
UrlString,

@@ -211,3 +208,4 @@ CommonEndSessionRequest,

authorityUrl?: string,
requestAzureCloudOptions?: AzureCloudOptions
requestAzureCloudOptions?: AzureCloudOptions,
account?: AccountInfo
): Promise<AuthorizationCodeClient> {

@@ -225,3 +223,8 @@ this.performanceClient.addQueueMeasurement(

this.correlationId
)(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
)(
serverTelemetryManager,
authorityUrl,
requestAzureCloudOptions,
account
);
return new AuthorizationCodeClient(

@@ -242,3 +245,4 @@ clientConfig,

requestAuthority?: string,
requestAzureCloudOptions?: AzureCloudOptions
requestAzureCloudOptions?: AzureCloudOptions,
account?: AccountInfo
): Promise<ClientConfiguration> {

@@ -255,3 +259,3 @@ this.performanceClient.addQueueMeasurement(

this.correlationId
)(requestAuthority, requestAzureCloudOptions);
)(requestAuthority, requestAzureCloudOptions, account);
const logger = this.config.system.loggerOptions;

@@ -295,52 +299,2 @@

/**
* Used to get a discovered version of the default authority.
* @param requestAuthority
* @param requestCorrelationId
*/
protected async getDiscoveredAuthority(
requestAuthority?: string,
requestAzureCloudOptions?: AzureCloudOptions
): Promise<Authority> {
this.performanceClient.addQueueMeasurement(
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
this.correlationId
);
const authorityOptions: AuthorityOptions = {
protocolMode: this.config.auth.protocolMode,
OIDCOptions: this.config.auth.OIDCOptions,
knownAuthorities: this.config.auth.knownAuthorities,
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
authorityMetadata: this.config.auth.authorityMetadata,
skipAuthorityMetadataCache:
this.config.auth.skipAuthorityMetadataCache,
};
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
const userAuthority = requestAuthority
? requestAuthority
: this.config.auth.authority;
// fall back to the authority from config
const builtAuthority = Authority.generateAuthority(
userAuthority,
requestAzureCloudOptions || this.config.auth.azureCloudOptions
);
return invokeAsync(
AuthorityFactory.createDiscoveredInstance.bind(AuthorityFactory),
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
this.logger,
this.performanceClient,
this.correlationId
)(
builtAuthority,
this.config.system.networkClient,
this.browserStorage,
authorityOptions,
this.logger,
this.correlationId,
this.performanceClient
);
}
/**
* Helper to initialize required request parameters for interactive APIs and ssoSilent()

@@ -347,0 +301,0 @@ * @param request

/* eslint-disable header/header */
export const name = "@azure/msal-browser";
export const version = "3.7.1";
export const version = "3.7.2-alpha.0";

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 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 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 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc