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

@microsoft/mgt-msal2-provider

Package Overview
Dependencies
Maintainers
2
Versions
741
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/mgt-msal2-provider - npm Package Compare versions

Comparing version 3.1.3-preview.00b168b to 3.1.3-preview.00fe946

6

dist/es6/exports.d.ts

@@ -0,3 +1,9 @@

/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';
//# sourceMappingURL=exports.d.ts.map

@@ -0,3 +1,9 @@

/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';
//# sourceMappingURL=exports.js.map

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

/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
export * from './mgt-msal2-provider';
export * from './exports';
//# sourceMappingURL=index.d.ts.map

3

dist/es6/index.js

@@ -7,5 +7,4 @@ /**

*/
import { registerMgtMsal2Provider } from './mgt-msal2-provider';
registerMgtMsal2Provider();
export * from './mgt-msal2-provider';
export * from './exports';
//# sourceMappingURL=index.js.map

@@ -147,3 +147,3 @@ /**

* @export
* @enum {number}
* @enum {string}
*/

@@ -276,2 +276,3 @@ export declare enum PromptType {

private initProvider;
private readonly handleMsalEvent;
/**

@@ -278,0 +279,0 @@ * Attempts to sign in user silently

@@ -22,3 +22,3 @@ /**

* @export
* @enum {number}
* @enum {string}
*/

@@ -108,2 +108,7 @@ export var PromptType;

this.isMultipleAccountEnabled = true;
this.handleMsalEvent = (message) => {
if (message.eventType === 'msal:acquireTokenSuccess' && 'scopes' in message.payload) {
this.approvedScopes = message.payload.scopes;
}
};
void this.initProvider(config);

@@ -156,2 +161,3 @@ }

}
this._publicClientApplication.addEventCallback(this.handleMsalEvent);
yield this._publicClientApplication.initialize();

@@ -270,3 +276,12 @@ this.ms_config.system = msalConfig.system || {};

setActiveAccount(user) {
this._publicClientApplication.setActiveAccount(this._publicClientApplication.getAccountByHomeId(user.id));
const accountToSet = this._publicClientApplication.getAccountByHomeId(user.id);
const activeAccount = this._publicClientApplication.getActiveAccount();
const storedAccount = this.getStoredAccount();
// exit early if the account is already active and stored
if (storedAccount &&
storedAccount.homeAccountId === accountToSet.homeAccountId &&
activeAccount.homeAccountId === accountToSet.homeAccountId) {
return;
}
this._publicClientApplication.setActiveAccount(accountToSet);
this.setStoredAccount();

@@ -273,0 +288,0 @@ super.setActiveAccount(user);

{
"name": "@microsoft/mgt-msal2-provider",
"version": "3.1.3-preview.00b168b",
"version": "3.1.3-preview.00fe946",
"description": "The Microsoft Graph Toolkit Msal 2.0 Provider",

@@ -47,3 +47,3 @@ "keywords": [

"@azure/msal-browser": "^2.22.0",
"@microsoft/mgt-element": "3.1.3-preview.00b168b",
"@microsoft/mgt-element": "3.1.3-preview.00fe946",
"@microsoft/microsoft-graph-client": "3.0.2"

@@ -50,0 +50,0 @@ },

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

/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';

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

*/
import { registerMgtMsal2Provider } from './mgt-msal2-provider';
registerMgtMsal2Provider();
export * from './mgt-msal2-provider';
export * from './exports';

@@ -25,3 +25,5 @@ /**

InteractionRequiredAuthError,
SsoSilentRequest
SsoSilentRequest,
EventMessage,
AuthenticationResult
} from '@azure/msal-browser';

@@ -180,3 +182,3 @@ import { AuthenticationProviderOptions } from '@microsoft/microsoft-graph-client';

* @export
* @enum {number}
* @enum {string}
*/

@@ -391,2 +393,3 @@ export enum PromptType {

}
this._publicClientApplication.addEventCallback(this.handleMsalEvent);
await this._publicClientApplication.initialize();

@@ -425,2 +428,8 @@

private readonly handleMsalEvent = (message: EventMessage): void => {
if (message.eventType === 'msal:acquireTokenSuccess' && 'scopes' in message.payload) {
this.approvedScopes = message.payload.scopes;
}
};
/**

@@ -503,3 +512,14 @@ * Attempts to sign in user silently

public setActiveAccount(user: IProviderAccount) {
this._publicClientApplication.setActiveAccount(this._publicClientApplication.getAccountByHomeId(user.id));
const accountToSet = this._publicClientApplication.getAccountByHomeId(user.id);
const activeAccount = this._publicClientApplication.getActiveAccount();
const storedAccount = this.getStoredAccount();
// exit early if the account is already active and stored
if (
storedAccount &&
storedAccount.homeAccountId === accountToSet.homeAccountId &&
activeAccount.homeAccountId === accountToSet.homeAccountId
) {
return;
}
this._publicClientApplication.setActiveAccount(accountToSet);
this.setStoredAccount();

@@ -506,0 +526,0 @@ super.setActiveAccount(user);

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

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