Socket
Socket
Sign inDemoInstall

@azure/msal-browser

Package Overview
Dependencies
Maintainers
3
Versions
117
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.5.0 to 3.5.1-beta.0

0

dist/app/IPublicClientApplication.d.ts

@@ -0,0 +0,0 @@ import { AccountInfo, Logger, PerformanceCallbackFunction } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { ITokenCache } from "../cache/ITokenCache";

@@ -0,0 +0,0 @@ import { ITokenCache } from "../cache/ITokenCache";

@@ -0,0 +0,0 @@ import { Logger, AuthenticationScheme, IPerformanceClient } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { NativeExtensionMethod } from "../../utils/BrowserConstants";

@@ -0,0 +0,0 @@ export declare const USER_INTERACTION_REQUIRED = "USER_INTERACTION_REQUIRED";

@@ -0,0 +0,0 @@ import { Logger } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType, TokenKeys, CredentialType, IPerformanceClient, StaticAuthorityOptions } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { IWindowStorage } from "./IWindowStorage";

@@ -0,0 +0,0 @@ import { Logger } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { IAsyncStorage } from "./IAsyncMemoryStorage";

@@ -0,0 +0,0 @@ export interface IAsyncStorage<T> {

@@ -0,0 +0,0 @@ import { ExternalTokenResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ export interface IWindowStorage<T> {

@@ -0,0 +0,0 @@ import { IWindowStorage } from "./IWindowStorage";

@@ -0,0 +0,0 @@ import { ICrypto, Logger, ExternalTokenResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode, OIDCOptions, AzureCloudOptions, ApplicationTelemetry, IPerformanceClient } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { IController } from "./IController";

@@ -0,0 +0,0 @@ import { AccountInfo, Logger, PerformanceCallbackFunction, IPerformanceClient, AccountFilter } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest, CommonSilentFlowRequest, PerformanceCallbackFunction, AccountInfo, Logger, ICrypto, IPerformanceClient, AccountFilter } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AccountInfo, INetworkModule, Logger, CommonSilentFlowRequest, ICrypto, PerformanceCallbackFunction, IPerformanceClient, BaseAuthRequest, AccountFilter } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest, CommonSilentFlowRequest, PerformanceCallbackFunction, AccountInfo, Logger, ICrypto, IPerformanceClient, AccountFilter } from "@azure/msal-common";

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

@@ -0,0 +0,0 @@ import { ICrypto, IPerformanceClient, Logger, ShrOptions, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { IPerformanceClient, Logger, PkceCodes } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { LoggerOptions, SignedHttpRequestParameters } from "@azure/msal-common";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import { AuthError } from "@azure/msal-common";

@@ -0,0 +0,0 @@ export declare const pkceNotCreated = "pkce_not_created";

@@ -0,0 +0,0 @@ import { AuthError } from "@azure/msal-common";

@@ -0,0 +0,0 @@ export declare const storageNotSupported = "storage_not_supported";

@@ -0,0 +0,0 @@ import { AuthError } from "@azure/msal-common";

export declare const contentError = "ContentError";
export declare const userSwitch = "user_switch";
//# sourceMappingURL=NativeAuthErrorCodes.d.ts.map

@@ -0,0 +0,0 @@ import { AuthError } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { ICrypto, Logger } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AuthError, AccountInfo } from "@azure/msal-common";

@@ -0,0 +0,0 @@ export declare const EventType: {

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import { ICrypto, INetworkModule, Logger, AccountInfo, BaseAuthRequest, ServerTelemetryManager, Authority, IPerformanceClient } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AuthorizationCodeClient, ClientConfiguration } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { Logger, ICrypto, AccountEntity, ScopeSet, IPerformanceClient, TokenClaims } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonEndSessionRequest, IPerformanceClient, Logger, ICrypto } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { ServerTelemetryManager, ServerAuthorizationCodeResponse, ICrypto, Logger, IPerformanceClient } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { ICrypto, Logger, IPerformanceClient } from "@azure/msal-common";

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

@@ -0,0 +0,0 @@ import { ICrypto, Logger, AuthorizationCodeClient, IPerformanceClient } from "@azure/msal-common";

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

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

@@ -0,0 +0,0 @@ import { AuthorizationCodePayload, CommonAuthorizationCodeRequest, AuthorizationCodeClient, CcsCredential, Logger, IPerformanceClient, ServerAuthorizationCodeResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AuthorizationCodeClient, CommonAuthorizationCodeRequest, Logger, IPerformanceClient, CcsCredential, ServerAuthorizationCodeResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { Logger, IPerformanceClient, ServerResponseType } from "@azure/msal-common";

7

dist/naa/AccountInfo.d.ts
export type AccountInfo = {
homeAccountId: string;
homeAccountId?: string;
environment: string;
tenantId: string;
tenantId?: string;
username: string;
localAccountId: string;
localAccountId?: string;
name?: string;

@@ -11,4 +11,3 @@ idToken?: string;

idTokenClaims?: object;
client_info?: string;
};
//# sourceMappingURL=AccountInfo.d.ts.map

@@ -0,0 +0,0 @@ export type AccountByHomeIdRequest = {

@@ -0,0 +0,0 @@ export interface AuthBridge {

@@ -0,0 +0,0 @@ export interface BridgeCapabilities {

import { BridgeStatusCode } from "./BridgeStatusCode";
export type BridgeError = {
status: BridgeStatusCode;
code: string;
subError: string;
description: string;
properties: object;
code?: string;
subError?: string;
description?: string;
properties?: object;
};
export declare function isBridgeError(error: unknown): error is BridgeError;
//# sourceMappingURL=BridgeError.d.ts.map

@@ -24,3 +24,3 @@ import { AccountInfo } from "./AccountInfo";

sdkVersion: string;
capabilities: BridgeCapabilities;
capabilities?: BridgeCapabilities;
/**

@@ -53,2 +53,3 @@ * initializeNestedAppAuthBridge - Initializes the bridge to the host app

getActiveAccount(): Promise<AccountInfo>;
getHostCapabilities(): BridgeCapabilities | null;
/**

@@ -55,0 +56,0 @@ * A method used to send a request to the bridge

@@ -0,0 +0,0 @@ export type BridgeRequest<TResponse> = {

@@ -0,0 +0,0 @@ import { TokenRequest } from "./TokenRequest";

@@ -0,0 +0,0 @@ import { BridgeError } from "./BridgeError";

@@ -0,0 +0,0 @@ export declare enum BridgeStatusCode {

import { AccountInfo } from "./AccountInfo";
import { AccountByHomeIdRequest, AccountByLocalIdRequest, AccountByUsernameRequest } from "./AccountRequests";
import { BridgeCapabilities } from "./BridgeCapabilities";
import { TokenRequest } from "./TokenRequest";

@@ -10,3 +11,4 @@ import { TokenResponse } from "./TokenResponse";

getActiveAccount(): Promise<AccountInfo>;
getHostCapabilities(): BridgeCapabilities | null;
}
//# sourceMappingURL=IBridgeProxy.d.ts.map
import { BridgeCapabilities } from "./BridgeCapabilities";
export interface InitializeBridgeResponse {
capabilities: BridgeCapabilities;
capabilities?: BridgeCapabilities;
sdkName: string;

@@ -5,0 +5,0 @@ sdkVersion: string;

@@ -6,4 +6,3 @@ import { TokenRequest } from "../TokenRequest";

import { TokenResponse } from "../TokenResponse";
import { AccountInfo as MsalAccountInfo, AuthError, ClientAuthError, ClientConfigurationError, InteractionRequiredAuthError, ServerError, ICrypto, Logger } from "@azure/msal-common";
import { SilentRequest } from "../../request/SilentRequest";
import { AccountInfo as MsalAccountInfo, AuthError, ClientAuthError, ClientConfigurationError, InteractionRequiredAuthError, ServerError, ICrypto, Logger, TokenClaims } from "@azure/msal-common";
import { AuthenticationResult } from "../../response/AuthenticationResult";

@@ -16,6 +15,5 @@ export declare class NestedAppAuthAdapter {

constructor(clientId: string, clientCapabilities: string[], crypto: ICrypto, logger: Logger);
toNaaSilentTokenRequest(request: SilentRequest): TokenRequest;
toNaaTokenRequest(request: PopupRequest | RedirectRequest): TokenRequest;
fromNaaTokenResponse(request: TokenRequest, response: TokenResponse): AuthenticationResult;
fromNaaAccountInfo(fromAccount: NaaAccountInfo): MsalAccountInfo;
fromNaaTokenResponse(request: TokenRequest, response: TokenResponse, reqTimestamp: number): AuthenticationResult;
fromNaaAccountInfo(fromAccount: NaaAccountInfo, idTokenClaims?: TokenClaims): MsalAccountInfo;
/**

@@ -22,0 +20,0 @@ *

@@ -7,3 +7,2 @@ export type TokenRequest = {

correlationId: string;
prompt?: string;
nonce?: string;

@@ -17,3 +16,2 @@ claims?: string;

shrNonce?: string;
clientCapabilities?: string[];
resourceRequestMethod?: string;

@@ -20,0 +18,0 @@ resourceRequestUri?: string;

@@ -5,3 +5,2 @@ import { AccountInfo } from "./AccountInfo";

account: AccountInfo;
client_info: string;
expires_in: number;

@@ -11,5 +10,5 @@ id_token: string;

scope: string;
state: string;
shr?: string;
extendedLifetimeToken?: boolean;
authority?: string;
};

@@ -16,0 +15,0 @@ export type TokenResponseProperties = {

@@ -0,0 +0,0 @@ import { NavigationOptions } from "./NavigationOptions";

@@ -0,0 +0,0 @@ import { INavigationClient } from "./INavigationClient";

@@ -0,0 +0,0 @@ import { ApiId } from "../utils/BrowserConstants";

@@ -0,0 +0,0 @@ import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { Logger } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { BaseOperatingContext } from "./BaseOperatingContext";

@@ -0,0 +0,0 @@ import { BaseOperatingContext } from "./BaseOperatingContext";

@@ -0,0 +0,0 @@ import { BaseOperatingContext } from "./BaseOperatingContext";

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

@@ -0,0 +0,0 @@ import { CommonAuthorizationCodeRequest } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AccountInfo } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonEndSessionRequest } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonEndSessionRequest } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AccountInfo, CommonSilentFlowRequest, StringDict } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { AccountInfo, AuthenticationResult as CommonAuthenticationResult } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { ICrypto, Logger, ServerAuthorizationCodeResponse } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { PerformanceEvents, IPerformanceClient, PerformanceClient, IPerformanceMeasurement, InProgressPerformanceEvent } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { IPerformanceMeasurement, SubMeasurement } from "@azure/msal-common";

@@ -0,0 +0,0 @@ import { PopupRequest } from "../request/PopupRequest";

@@ -0,0 +0,0 @@ import { InteractionType } from "./BrowserConstants";

@@ -0,0 +0,0 @@ import { InteractionType } from "./BrowserConstants";

{
"name": "@azure/msal-browser",
"author": {
"name": "Microsoft",
"email": "nugetaad@microsoft.com",
"url": "https://www.microsoft.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
},
"version": "3.5.0",
"description": "Microsoft Authentication Library for js",
"keywords": [
"implicit",
"authorization code",
"PKCE",
"js",
"AAD",
"msal",
"oauth"
],
"type": "module",
"sideEffects": false,
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./lib/msal-browser.cjs",
"default": "./dist/index.mjs"
"name": "@azure/msal-browser",
"author": {
"name": "Microsoft",
"email": "nugetaad@microsoft.com",
"url": "https://www.microsoft.com"
},
"./package.json": "./package.json"
},
"engines": {
"node": ">=0.8.0"
},
"beachball": {
"disallowedChangeTypes": [
"major"
]
},
"directories": {
"test": "test"
},
"files": [
"dist",
"lib/msal-browser.js",
"lib/msal-browser.js.map",
"lib/msal-browser.cjs",
"lib/msal-browser.cjs.map",
"lib/msal-browser.min.js",
"src"
],
"scripts": {
"clean": "shx rm -rf dist lib",
"clean:coverage": "rimraf ../../.nyc_output/*",
"lint": "eslint src --ext .ts",
"lint:fix": "npm run lint -- --fix",
"test": "jest",
"test:coverage": "jest --coverage",
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
"build:all": "cd ../.. && npm run build --workspace=@azure/msal-common --workspace=@azure/msal-browser",
"build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
"build:modules:watch": "rollup -cw --bundleConfigAsCjs",
"build": "npm run clean && npm run build:modules",
"prepack": "npm run build:all",
"format:check": "npx prettier --ignore-path .gitignore --check src test",
"format:fix": "npx prettier --ignore-path .gitignore --write src test"
},
"devDependencies": {
"@azure/storage-blob": "^12.2.1",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.0.0",
"@types/jest": "^29.5.0",
"@types/node": "^20.3.1",
"@types/sinon": "^7.5.0",
"dotenv": "^8.2.0",
"eslint-config-msal": "^0.0.0",
"fake-indexeddb": "^3.1.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.7",
"rimraf": "^3.0.0",
"rollup": "^3.14.0",
"shx": "^0.3.2",
"sinon": "^7.5.0",
"ssri": "^8.0.1",
"ts-jest": "^29.1.0",
"tslib": "^1.10.0",
"typescript": "^4.9.5"
},
"dependencies": {
"@azure/msal-common": "14.4.0"
}
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
},
"version": "3.5.1-beta.0",
"description": "Microsoft Authentication Library for js",
"keywords": [
"implicit",
"authorization code",
"PKCE",
"js",
"AAD",
"msal",
"oauth"
],
"type": "module",
"sideEffects": false,
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./lib/msal-browser.cjs",
"default": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"engines": {
"node": ">=0.8.0"
},
"beachball": {
"disallowedChangeTypes": [
"major"
]
},
"directories": {
"test": "test"
},
"files": [
"dist",
"lib/msal-browser.js",
"lib/msal-browser.js.map",
"lib/msal-browser.cjs",
"lib/msal-browser.cjs.map",
"lib/msal-browser.min.js",
"src"
],
"scripts": {
"clean": "shx rm -rf dist lib",
"clean:coverage": "rimraf ../../.nyc_output/*",
"lint": "eslint src --ext .ts",
"lint:fix": "npm run lint -- --fix",
"test": "jest",
"test:coverage": "jest --coverage",
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
"build:all": "cd ../.. && npm run build --workspace=@azure/msal-common --workspace=@azure/msal-browser",
"build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
"build:modules:watch": "rollup -cw --bundleConfigAsCjs",
"build": "npm run clean && npm run build:modules",
"prepack": "npm run build:all",
"format:check": "npx prettier --ignore-path .gitignore --check src test",
"format:fix": "npx prettier --ignore-path .gitignore --write src test"
},
"devDependencies": {
"@azure/storage-blob": "^12.2.1",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.0.0",
"@types/jest": "^29.5.0",
"@types/node": "^20.3.1",
"@types/sinon": "^7.5.0",
"dotenv": "^8.2.0",
"eslint-config-msal": "^0.0.0",
"fake-indexeddb": "^3.1.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.7",
"rimraf": "^3.0.0",
"rollup": "^3.14.0",
"shx": "^0.3.2",
"sinon": "^7.5.0",
"ssri": "^8.0.1",
"ts-jest": "^29.1.0",
"tslib": "^1.10.0",
"typescript": "^4.9.5"
},
"dependencies": {
"@azure/msal-common": "14.4.1-beta.0"
}
}

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

AccountFilter,
TimeUtils,
} from "@azure/msal-common";

@@ -138,2 +139,3 @@ import { ITokenCache } from "../cache/ITokenCache";

this.nestedAppAuthAdapter.toNaaTokenRequest(request);
const reqTimestamp = TimeUtils.nowSeconds();
const response = await this.bridgeProxy.getTokenInteractive(

@@ -145,3 +147,4 @@ naaRequest

naaRequest,
response
response,
reqTimestamp
);

@@ -210,3 +213,4 @@

const naaRequest =
this.nestedAppAuthAdapter.toNaaSilentTokenRequest(request);
this.nestedAppAuthAdapter.toNaaTokenRequest(request);
const reqTimestamp = TimeUtils.nowSeconds();
const response = await this.bridgeProxy.getTokenSilent(naaRequest);

@@ -217,3 +221,4 @@

naaRequest,
response
response,
reqTimestamp
);

@@ -220,0 +225,0 @@

@@ -7,7 +7,7 @@ /*

export type AccountInfo = {
homeAccountId: string;
homeAccountId?: string;
environment: string;
tenantId: string;
tenantId?: string;
username: string;
localAccountId: string;
localAccountId?: string;
name?: string;

@@ -17,3 +17,2 @@ idToken?: string; // idTokenClaims can be parsed from idToken in MSAL.js

idTokenClaims?: object;
client_info?: string;
};

@@ -10,6 +10,6 @@ /*

status: BridgeStatusCode;
code: string; // auth_flow_last_error such as invalid_grant
subError: string; // server_suberror_code such as consent_required
description: string;
properties: object; // additional telemetry info
code?: string; // auth_flow_last_error such as invalid_grant
subError?: string; // server_suberror_code such as consent_required
description?: string;
properties?: object; // additional telemetry info
};

@@ -16,0 +16,0 @@

@@ -39,3 +39,3 @@ /*

sdkVersion: string;
capabilities: BridgeCapabilities;
capabilities?: BridgeCapabilities;

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

public getHostCapabilities(): BridgeCapabilities | null {
return this.capabilities ?? null;
}
/**

@@ -211,3 +215,3 @@ * A method used to send a request to the bridge

sdkVersion: string,
capabilities: BridgeCapabilities
capabilities?: BridgeCapabilities
) {

@@ -214,0 +218,0 @@ this.sdkName = sdkName;

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

} from "./AccountRequests";
import { BridgeCapabilities } from "./BridgeCapabilities";
import { TokenRequest } from "./TokenRequest";

@@ -26,2 +27,3 @@ import { TokenResponse } from "./TokenResponse";

getActiveAccount(): Promise<AccountInfo>;
getHostCapabilities(): BridgeCapabilities | null;
}

@@ -9,5 +9,5 @@ /*

export interface InitializeBridgeResponse {
capabilities: BridgeCapabilities;
capabilities?: BridgeCapabilities;
sdkName: string;
sdkVersion: string;
}

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

ServerError,
TimeUtils,
ICrypto,

@@ -25,6 +24,9 @@ Logger,

ClientAuthErrorCodes,
AuthenticationScheme,
RequestParameterBuilder,
StringUtils,
createClientAuthError,
} from "@azure/msal-common";
import { isBridgeError } from "../BridgeError";
import { BridgeStatusCode } from "../BridgeStatusCode";
import { SilentRequest } from "../../request/SilentRequest";
import { AuthenticationResult } from "../../response/AuthenticationResult";

@@ -51,37 +53,2 @@ import {} from "../../error/BrowserAuthErrorCodes";

public toNaaSilentTokenRequest(request: SilentRequest): TokenRequest {
let extraParams: Map<string, string>;
if (request.extraQueryParameters === undefined) {
extraParams = new Map<string, string>();
} else {
extraParams = new Map<string, string>(
Object.entries(request.extraQueryParameters)
);
}
/**
* Need to get information about the client to populate request correctly
* For example: client id, client capabilities
*/
const tokenRequest: TokenRequest = {
userObjectId: request.account?.homeAccountId,
clientId: this.clientId,
authority: request.authority,
scope: request.scopes.join(" "),
correlationId:
request.correlationId !== undefined
? request.correlationId
: this.crypto.createNewGuid(),
prompt: request.prompt !== undefined ? request.prompt : "",
claims: request.claims !== undefined ? request.claims : "",
authenticationScheme:
request.authenticationScheme !== undefined
? request.authenticationScheme
: "",
clientCapabilities: this.clientCapabilities,
extraParameters: extraParams,
};
return tokenRequest;
}
public toNaaTokenRequest(

@@ -99,2 +66,7 @@ request: PopupRequest | RedirectRequest

const requestBuilder = new RequestParameterBuilder();
const claims = requestBuilder.addClientCapabilitiesToClaims(
request.claims,
this.clientCapabilities
);
const tokenRequest: TokenRequest = {

@@ -108,12 +80,8 @@ userObjectId: request.account?.homeAccountId,

? request.correlationId
: "",
prompt: request.prompt !== undefined ? request.prompt : "",
nonce: request.nonce !== undefined ? request.nonce : "",
claims: request.claims !== undefined ? request.claims : "",
state: request.state !== undefined ? request.state : "",
: this.crypto.createNewGuid(),
nonce: request.nonce,
claims: !StringUtils.isEmptyObj(claims) ? claims : undefined,
state: request.state,
authenticationScheme:
request.authenticationScheme !== undefined
? request.authenticationScheme
: "",
clientCapabilities: undefined,
request.authenticationScheme || AuthenticationScheme.BEARER,
extraParameters: extraParams,

@@ -127,21 +95,29 @@ };

request: TokenRequest,
response: TokenResponse
response: TokenResponse,
reqTimestamp: number
): AuthenticationResult {
if (!response.id_token || !response.access_token) {
throw createClientAuthError(ClientAuthErrorCodes.nullOrEmptyToken);
}
const expiresOn = new Date(
TimeUtils.nowSeconds() + (response.expires_in || 0) * 1000
(reqTimestamp + (response.expires_in || 0)) * 1000
);
const idTokenClaims = AuthToken.extractTokenClaims(
response.id_token,
this.crypto.base64Decode
);
const account = this.fromNaaAccountInfo(
response.account,
idTokenClaims
);
const account = this.fromNaaAccountInfo(response.account);
const authenticationResult: AuthenticationResult = {
authority: response.account.environment,
uniqueId: response.account.homeAccountId,
tenantId: response.account.tenantId,
authority: response.authority || account.environment,
uniqueId: account.localAccountId,
tenantId: account.tenantId,
scopes: response.scope.split(" "),
account: this.fromNaaAccountInfo(response.account),
account,
idToken: response.id_token !== undefined ? response.id_token : "",
idTokenClaims:
account.idTokenClaims !== undefined
? account.idTokenClaims
: {},
idTokenClaims,
accessToken: response.access_token,

@@ -151,9 +127,6 @@ fromCache: true,

tokenType:
request.authenticationScheme !== undefined
? request.authenticationScheme
: "Bearer",
request.authenticationScheme || AuthenticationScheme.BEARER,
correlationId: request.correlationId,
requestId: "",
extExpiresOn: expiresOn,
state: response.state,
state: request.state,
};

@@ -186,22 +159,37 @@

*/
public fromNaaAccountInfo(fromAccount: NaaAccountInfo): MsalAccountInfo {
let tokenClaims: TokenClaims | undefined;
if (fromAccount.idToken !== undefined) {
tokenClaims = AuthToken.extractTokenClaims(
fromAccount.idToken,
this.crypto.base64Decode
);
} else {
tokenClaims = undefined;
}
public fromNaaAccountInfo(
fromAccount: NaaAccountInfo,
idTokenClaims?: TokenClaims
): MsalAccountInfo {
const effectiveIdTokenClaims =
idTokenClaims || (fromAccount.idTokenClaims as TokenClaims);
const localAccountId =
fromAccount.localAccountId ||
effectiveIdTokenClaims?.oid ||
effectiveIdTokenClaims?.sub ||
"";
const tenantId =
fromAccount.tenantId || effectiveIdTokenClaims?.tid || "";
const homeAccountId =
fromAccount.homeAccountId || `${localAccountId}.${tenantId}`;
const username =
fromAccount.username ||
effectiveIdTokenClaims?.preferred_username ||
"";
const name = fromAccount.name || effectiveIdTokenClaims?.name;
const account: MsalAccountInfo = {
homeAccountId: fromAccount.homeAccountId,
homeAccountId,
environment: fromAccount.environment,
tenantId: fromAccount.tenantId,
username: fromAccount.username,
localAccountId: fromAccount.localAccountId,
name: fromAccount.name,
tenantId,
username,
localAccountId,
name,
idToken: fromAccount.idToken,
idTokenClaims: tokenClaims,
idTokenClaims: effectiveIdTokenClaims,
};

@@ -244,3 +232,7 @@

case BridgeStatusCode.NESTED_APP_AUTH_UNAVAILABLE:
return new ClientAuthError(error.code, error.description);
return new ClientAuthError(
error.code ||
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
error.description
);
case BridgeStatusCode.TRANSIENT_ERROR:

@@ -247,0 +239,0 @@ case BridgeStatusCode.PERSISTENT_ERROR:

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

correlationId: string;
prompt?: string; // Prompt used to identify interactive request
nonce?: string;

@@ -22,3 +21,2 @@ claims?: string;

shrNonce?: string;
clientCapabilities?: string[]; // CP1 for CAE support
resourceRequestMethod?: string;

@@ -25,0 +23,0 @@ resourceRequestUri?: string;

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

account: AccountInfo;
client_info: string;
expires_in: number;

@@ -17,5 +16,5 @@ id_token: string;

scope: string;
state: string;
shr?: string; // token binding enabled at native layer it is the access token, not the signing keys
extendedLifetimeToken?: boolean;
authority?: string;
};

@@ -22,0 +21,0 @@

@@ -73,3 +73,6 @@ /*

try {
this.activeAccount = await bridgeProxy.getActiveAccount();
if (bridgeProxy.getHostCapabilities()?.queryAccount) {
this.activeAccount =
await bridgeProxy.getActiveAccount();
}
} catch (e) {

@@ -76,0 +79,0 @@ this.activeAccount = undefined;

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

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