Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/msal-browser

Package Overview
Dependencies
Maintainers
3
Versions
122
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 2.1.0 to 2.2.0

dist/src/app/ClientApplication.d.ts

115

CHANGELOG.json

@@ -5,2 +5,117 @@ {

{
"date": "Thu, 17 Sep 2020 23:16:22 GMT",
"tag": "@azure/msal-browser_v2.2.0",
"version": "2.2.0",
"comments": {
"patch": [
{
"comment": "Fix issue with base64 encoding of spaces (#2248)",
"author": "prkanher@microsoft.com",
"commit": "",
"package": "@azure/msal-browser"
},
{
"comment": "Properly support multiple concurrent RT requests (#2290)",
"author": "janutter@microsoft.com",
"commit": "5956762593a9d0d2b23a33d8ad9f94eb5d2342dd",
"package": "@azure/msal-browser"
},
{
"comment": "Default scope addition done in msal-common (#2267)",
"author": "thomas.norling@microsoft.com",
"commit": "3a18b100f38149a35c01cc491a9de78ea505d771",
"package": "@azure/msal-browser"
},
{
"comment": "acquireTokenSilent calls ssoSilent (#2264)",
"author": "thomas.norling@microsoft.com",
"commit": "6923e66fc9ca44c460489b41ff6a4d104ebde864",
"package": "@azure/msal-browser"
},
{
"comment": "Check for interaction in progress when processing redirect hash (#2183)",
"author": "thomas.norling@microsoft.com",
"commit": "40458a19510286c3ad7eba566bdd283d7ba83bfa",
"package": "@azure/msal-browser"
},
{
"comment": "Creating ClientApplication.ts subclass (#2199)",
"author": "prkanher@microsoft.com",
"commit": "6750c4f1aa6a230bac76c37aab185aa04b894a2c",
"package": "@azure/msal-browser"
},
{
"comment": "Add SsoSilentRequest for ssoSilent, update tests and samples",
"author": "joarroyo@microsoft.com",
"commit": "a7e1bb304b93509400405915a4df32e651ec16bf",
"package": "@azure/msal-browser"
},
{
"comment": "Add Angular 10 browser sample, update documentation",
"author": "joarroyo@microsoft.com",
"commit": "98e1960987d13950d080ba5e15b0b17260ec47e2",
"package": "@azure/msal-browser"
}
],
"none": [
{
"comment": "Add name field to AccountInfo (#2288)",
"author": "jamckenn@microsoft.com",
"commit": "d917d6a91987522f1c4390817966945ce18fa099",
"package": "@azure/msal-browser"
},
{
"comment": "Update core, browser, common to use central eslint configuration",
"author": "janutter@microsoft.com",
"commit": "fc49c6f16b3f7a62a67d249107fc484272133305",
"package": "@azure/msal-browser"
},
{
"comment": "Doc updates (#2215)",
"author": "thomas.norling@microsoft.com",
"commit": "b50572c407dbe3a5f61ebde7d50171e9044cb894",
"package": "@azure/msal-browser"
},
{
"comment": "Doc updates",
"author": "thomas.norling@microsoft.com",
"commit": "a89fcea6df5c806a99de9e38ca67816910c93883",
"package": "@azure/msal-browser"
},
{
"comment": "update cdn hash for v2.1.0",
"author": "prkanher@microsoft.com",
"commit": "14acf773f07700f8dd9bac1459e204d97385eb84",
"package": "@azure/msal-browser"
},
{
"comment": "Fix Unit Tests (#2191)",
"author": "thomas.norling@microsoft.com",
"commit": "f0f2d5c884431a93f32e50d78b2f29b83e6f0449",
"package": "@azure/msal-browser"
},
{
"comment": "Updating CDN docs",
"author": "prkanher@microsoft.com",
"commit": "f831b9f079665b839168a27badd2f9dcbe884214",
"package": "@azure/msal-browser"
},
{
"comment": "none",
"author": "sameera.gajjarapu@microsoft.com",
"commit": "9760b6ff6c0ad403ac1b26968cb10d3d7e72a6fd",
"package": "@azure/msal-browser"
}
],
"minor": [
{
"comment": "Added client-side throttling to enhance server stability (#1907)",
"author": "jamckenn@microsoft.com",
"commit": "91a1dba29dbfb8f6fc329c0381767d6b6f661281",
"package": "@azure/msal-browser"
}
]
}
},
{
"date": "Tue, 25 Aug 2020 00:40:45 GMT",

@@ -7,0 +122,0 @@ "tag": "@azure/msal-browser_v2.1.0",

21

changelog.md
# Change Log - @azure/msal-browser
This log was last generated on Tue, 25 Aug 2020 00:40:45 GMT and should not be manually modified.
This log was last generated on Thu, 17 Sep 2020 23:16:22 GMT and should not be manually modified.
<!-- Start content -->
## 2.2.0
Thu, 17 Sep 2020 23:16:22 GMT
### Minor changes
- Added client-side throttling to enhance server stability (#1907) (jamckenn@microsoft.com)
### Patches
- Fix issue with base64 encoding of spaces (#2248) (prkanher@microsoft.com)
- Properly support multiple concurrent RT requests (#2290) (janutter@microsoft.com)
- Default scope addition done in msal-common (#2267) (thomas.norling@microsoft.com)
- acquireTokenSilent calls ssoSilent (#2264) (thomas.norling@microsoft.com)
- Check for interaction in progress when processing redirect hash (#2183) (thomas.norling@microsoft.com)
- Creating ClientApplication.ts subclass (#2199) (prkanher@microsoft.com)
- Add SsoSilentRequest for ssoSilent, update tests and samples (joarroyo@microsoft.com)
- Add Angular 10 browser sample, update documentation (joarroyo@microsoft.com)
## 2.1.0

@@ -8,0 +27,0 @@

5

dist/src/app/IPublicClientApplication.d.ts

@@ -1,5 +0,6 @@

import { AuthenticationResult, AuthorizationUrlRequest, AccountInfo, EndSessionRequest } from "@azure/msal-common";
import { AuthenticationResult, AccountInfo, EndSessionRequest } from "@azure/msal-common";
import { RedirectRequest } from "../request/RedirectRequest";
import { PopupRequest } from "../request/PopupRequest";
import { SilentRequest } from "../request/SilentRequest";
import { SsoSilentRequest } from "../request/SsoSilentRequest";
export interface IPublicClientApplication {

@@ -16,3 +17,3 @@ acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;

logout(logoutRequest?: EndSessionRequest): Promise<void>;
ssoSilent(request: AuthorizationUrlRequest): Promise<AuthenticationResult>;
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
}

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

import { AuthorizationUrlRequest, AuthenticationResult, AccountInfo, EndSessionRequest } from "@azure/msal-common";
import { AuthenticationResult } from "@azure/msal-common";
import { Configuration } from "../config/Configuration";

@@ -6,2 +6,3 @@ import { IPublicClientApplication } from "./IPublicClientApplication";

import { PopupRequest } from "../request/PopupRequest";
import { ClientApplication } from "./ClientApplication";
import { SilentRequest } from "../request/SilentRequest";

@@ -12,10 +13,3 @@ /**

*/
export declare class PublicClientApplication implements IPublicClientApplication {
private readonly browserCrypto;
private readonly browserStorage;
private readonly networkClient;
private readonly tokenExchangePromise;
private config;
private defaultAuthority;
private logger;
export declare class PublicClientApplication extends ClientApplication implements IPublicClientApplication {
/**

@@ -44,27 +38,2 @@ * @constructor

/**
* Event handler function which allows users to fire events after the PublicClientApplication object
* has loaded during redirect flows. This should be invoked on all page loads involved in redirect
* auth flows.
* @returns {Promise.<AuthenticationResult | null>} token response or null. If the return value is null, then no auth redirect was detected.
*/
handleRedirectPromise(): Promise<AuthenticationResult | null>;
/**
* Checks if navigateToLoginRequestUrl is set, and:
* - if true, performs logic to cache and navigate
* - if false, handles hash string and parses response
*/
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
* @returns {string}
*/
private getRedirectResponseHash;
/**
* Checks if hash exists and handles in window.
* @param responseHash
* @param interactionHandler
*/
private handleHash;
/**
* Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so

@@ -80,12 +49,2 @@ * any code that follows this function will not execute.

/**
* 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
* the page, so any code that follows this function will not execute.
*
* IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
* browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
*
* @param {@link (RedirectRequest:type)}
*/
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
/**
* Use when initiating the login process via opening a popup window in the user's browser

@@ -98,146 +57,3 @@ *

loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;
/**
* Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
* @param {@link (PopupRequest:type)}
*
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
*/
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
/**
* Helper which obtains an access_token for your API via opening a popup window in the user's browser
* @param {@link (PopupRequest:type)}
*
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
*/
private acquireTokenPopupAsync;
/**
* This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
* - Any browser using a form of Intelligent Tracking Prevention
* - If there is not an established session with the service
*
* In these cases, the request must be done inside a popup or full frame redirect.
*
* For the cases where interaction is required, you cannot send a request with prompt=none.
*
* If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
* you session on the server still exists.
* @param {@link AuthorizationUrlRequest}
*
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
*/
ssoSilent(request: AuthorizationUrlRequest): Promise<AuthenticationResult>;
/**
* Use this function to obtain a token before every call to the API / resource provider
*
* MSAL return's a cached token when available
* Or it send's a request to the STS to obtain a new token using a refresh token.
*
* @param {@link (SilentRequest:type)}
*
* To renew idToken, please pass clientId as the only scope in the Authentication Parameters
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
*
*/
acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult>;
/**
* 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;
/**
* Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
* Default behaviour is to redirect the user to `window.location.href`.
* @param {@link (EndSessionRequest:type)}
*/
logout(logoutRequest?: EndSessionRequest): Promise<void>;
/**
* Returns all accounts that MSAL currently has data for.
* (the account object is created at the time of successful login)
* or empty array when no accounts are found
* @returns {@link AccountInfo[]} - Array of account objects in cache
*/
getAllAccounts(): AccountInfo[];
/**
* Returns the signed in account matching username.
* (the account object is created at the time of successful login)
* or null when no matching account is found.
* This API is provided for convenience but getAccountById should be used for best reliability
* @returns {@link AccountInfo} - the account object stored in MSAL
*/
getAccountByUsername(userName: string): AccountInfo | null;
/**
* Returns the signed in account matching homeAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @returns {@link AccountInfo} - the account object stored in MSAL
*/
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
/**
*
* Use to get the redirect uri configured in MSAL or null.
* @returns {string} redirect URL
*
*/
private getRedirectUri;
/**
* Use to get the post logout redirect uri configured in MSAL or null.
*
* @returns {string} post logout redirect URL
*/
private getPostLogoutRedirectUri;
/**
* Used to get a discovered version of the default authority.
*/
private getDiscoveredDefaultAuthority;
/**
* Helper to check whether interaction is in progress.
*/
private interactionInProgress;
/**
* Creates an Authorization Code Client with the given authority, or the default authority.
* @param authorityUrl
*/
private createAuthCodeClient;
/**
* Creates an Silent Flow Client with the given authority, or the default authority.
* @param authorityUrl
*/
private createSilentFlowClient;
/**
* Creates a Client Configuration object with the given request authority, or the default authority.
* @param requestAuthority
*/
private getClientConfiguration;
/**
* Helper to validate app environment before making a request.
*/
private preflightInteractiveRequest;
/**
* Initializer function for all request APIs
* @param request
*/
private initializeBaseRequest;
private initializeServerTelemetryManager;
/**
* Generates a request that will contain the openid and profile scopes.
* @param request
*/
private setDefaultScopes;
/**
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
* @param request
*/
private initializeAuthorizationRequest;
/**
* Generates an auth code request tied to the url request.
* @param request
*/
private initializeAuthorizationCodeRequest;
/**
* Initializer for the logout request.
* @param logoutRequest
*/
private initializeLogoutRequest;
}
import { AuthorizationCodeRequest, ICrypto, CacheManager } from "@azure/msal-common";
import { CacheOptions } from "../config/Configuration";
import { CryptoOps } from "../crypto/CryptoOps";
/**

@@ -12,3 +13,4 @@ * This class implements the cache storage interface for MSAL through browser local or session storage.

private clientId;
constructor(clientId: string, cacheConfig: CacheOptions);
private cryptoImpl;
constructor(clientId: string, cacheConfig: CacheOptions, cryptoImpl: CryptoOps);
/**

@@ -92,3 +94,3 @@ * Validates the the given cache location string is an expected value:

*/
clearMsalCookie(state?: string): void;
clearMsalCookie(stateString?: string): void;
/**

@@ -117,3 +119,3 @@ * Get cookie expiration time

*/
generateAuthorityKey(state: string): string;
generateAuthorityKey(stateString: string): string;
/**

@@ -123,4 +125,9 @@ * Create Nonce key to cache nonce

*/
generateNonceKey(state: string): string;
generateNonceKey(stateString: string): string;
/**
* Creates full cache key for the request state
* @param stateString State string for the request
*/
generateStateKey(stateString: string): string;
/**
* Sets the cacheKey for and stores the authority information in cache

@@ -134,3 +141,3 @@ * @param state

*/
getCachedAuthority(): string;
getCachedAuthority(cachedState: string): string;
/**

@@ -147,3 +154,3 @@ * Updates account, authority, and state in cache

resetRequestCache(state: string): void;
cleanRequest(): void;
cleanRequest(stateString?: string): void;
cacheCodeRequest(authCodeRequest: AuthorizationCodeRequest, browserCrypto: ICrypto): void;

@@ -150,0 +157,0 @@ /**

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

/**
* Creates an error thrown if cache type is invalid.
*/
* Creates an error thrown if cache type is invalid.
*/
static createInvalidCacheTypeError(): BrowserAuthError;
}

@@ -9,2 +9,3 @@ export { PublicClientApplication } from "./app/PublicClientApplication";

export { SilentRequest } from "./request/SilentRequest";
export { SsoSilentRequest } from "./request/SsoSilentRequest";
export { AccountInfo, AuthorizationUrlRequest, EndSessionRequest, AuthenticationResult, InteractionRequiredAuthError, AuthError, AuthErrorMessage, INetworkModule, ILoggerCallback, Logger, LogLevel } from "@azure/msal-common";

@@ -13,3 +13,3 @@ import { AuthorizationCodeRequest, ICrypto, AuthenticationResult } from "@azure/msal-common";

*/
handleCodeResponse(locationHash: string, browserCrypto?: ICrypto): Promise<AuthenticationResult>;
handleCodeResponse(locationHash: string, browserCrypto?: ICrypto, clientId?: string): Promise<AuthenticationResult>;
}

@@ -12,3 +12,3 @@ import { AuthorizationCodeRequest, AuthorizationCodeClient } from "@azure/msal-common";

*/
initiateAuthRequest(requestUrl: string, authCodeRequest: AuthorizationCodeRequest, userRequestScopes?: string): Promise<HTMLIFrameElement>;
initiateAuthRequest(requestUrl: string, authCodeRequest: AuthorizationCodeRequest): Promise<HTMLIFrameElement>;
/**

@@ -39,3 +39,3 @@ * Monitors an iframe content window until it loads a url with a known hash, or hits a specified timeout.

*/
private getHiddenIframe;
private createHiddenIframe;
/**

@@ -42,0 +42,0 @@ * @hidden

import { InteractionType } from "./BrowserConstants";
import { ICrypto } from "@azure/msal-common";
import { ICrypto, ServerAuthorizationCodeResponse } from "@azure/msal-common";
export declare type BrowserStateObject = {

@@ -13,2 +13,7 @@ interactionType: InteractionType;

static extractBrowserRequestState(browserCrypto: ICrypto, state: string): BrowserStateObject;
/**
* Parses properties of server response from url hash
* @param locationHash Hash from url
*/
static parseServerResponseFromHash(locationHash: string): ServerAuthorizationCodeResponse;
}

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

},
"version": "2.1.0",
"version": "2.2.0",
"description": "Microsoft Authentication Library for js",

@@ -41,3 +41,4 @@ "keywords": [

"clean:coverage": "rimraf ../../.nyc_output/*",
"lint": "eslint src --ext .ts",
"lint": "cd ../../ && npm run lint:browser",
"lint:fix": "npm run lint -- -- --fix",
"doc": "npm run doc:generate && npm run doc:deploy",

@@ -53,3 +54,3 @@ "doc:generate": "typedoc --mode modules --excludePrivate --excludeProtected --out ./ref ./src/ --gitRevision dev",

"build:modules:watch": "rollup -cw",
"build": "npm run clean && npm run lint && npm run build:modules",
"build": "npm run clean && npm run build:modules",
"prepack": "npm run build:all",

@@ -73,7 +74,4 @@ "sri": "npm run sri:msal && npm run sri:msalmin",

"@types/chai-as-promised": "^7.1.2",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.2",
"@types/sinon": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^2.4.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.4.0",
"@typescript-eslint/parser": "^2.4.0",
"babel-plugin-istanbul": "^5.2.0",

@@ -84,3 +82,2 @@ "beachball": "^1.32.2",

"dotenv": "^8.2.0",
"eslint": "^6.5.1",
"gh-pages": "^2.2.0",

@@ -106,4 +103,4 @@ "husky": "^3.0.9",

"dependencies": {
"@azure/msal-common": "^1.2.0"
"@azure/msal-common": "^1.3.0"
}
}

@@ -66,3 +66,3 @@ # Microsoft Authentication Library for JavaScript (MSAL.js) 2.0 for Browser-Based Single-Page Applications

```javascript
<script src="https://alcdn.msauth.net/browser/2.0.1/js/msal-browser.js" integrity="sha384-knPh00kvaT+k3+4TCD5S2ORDNVc2I3RVbqI/ksbTlpdSBh8ZnyAPxW2kkTSG0+mT" crossorigin="anonymous"></script>
<script src="https://alcdn.msauth.net/browser/2.1.0/js/msal-browser.js" integrity="sha384-M9bRB06LdiYadS+F9rPQnntFCYR3UJvtb2Vr4Tmhw9WBwWUfxH8VDRAFKNn3VTc/" crossorigin="anonymous"></script>
```

@@ -73,3 +73,3 @@

```javascript
<script src="https://alcdn.msauth.net/browser/2.0.1/js/msal-browser.min.js" integrity="sha384-fbyYRj8H9iJU/JyncEbzW6WgVOaR5C+PU1dHsRBg2Ag2Q14F4IB8+T8BdknwjRQ8" crossorigin="anonymous"></script>
<script src="https://alcdn.msauth.net/browser/2.1.0/js/msal-browser.min.js" integrity="sha384-EmYPwkfj+VVmL1brMS1h6jUztl4QMS8Qq8xlZNgIT/luzg7MAzDVrRa2JxbNmk/e" crossorigin="anonymous"></script>
```

@@ -105,2 +105,5 @@

Additionally, the `msal-angular-v2-samples` folder contains an Angular 10 sample app that uses msal-browser.
- You can run the angular10-browser sample by changing the `app.module.ts` file to match your app registration and running the `npm` command `npm start` in the angular-10-browser-sample folder.
Here is a complete list of samples for the MSAL.js 2.x library:

@@ -116,2 +119,3 @@

| [Internet Explorer 11 Sample]() | A vanilla JS sample showing usage of `@azure/msal-browser` in an application designed to run in Internet Explorer 11. | `npm start -- -s ie11-sample` |
| [Angular 10 Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v2-samples/angular10-browser-sample) | An Angular 10 sample showing usage of MSAL 2.0 with the Microsoft Graph API. | `npm start` |

@@ -118,0 +122,0 @@ More instructions to run the samples can be found in the [`README.md` file](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/Readme.md) of the VanillaJSTestApp2.0 folder.

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

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