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 to 4.0.0-next.mgt-chat.5c123b0

dist/es6/exports.d.ts

2

dist/es6/index.d.ts

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

*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';
export * from './exports';
//# sourceMappingURL=index.d.ts.map

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

*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';
export * from './exports';
//# sourceMappingURL=index.js.map

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

*/
import { MgtBaseProvider } from '@microsoft/mgt-element';
/**
* Authentication Library Provider for Microsoft personal accounts
*
* @export
* @class MgtMsalProvider
* @extends {MgtBaseProvider}
*/
export declare class MgtMsal2Provider extends MgtBaseProvider {
/**
* String alphanumerical value relation to a specific user
*
* @memberof MgtMsalProvider
*/
clientId: string;
/**
* login hint string
*
* @memberof MgtMsal2Provider
*/
loginHint: string;
/**
* domain hint string
*
* @memberof MgtMsal2Provider
*/
domainHint: string;
/**
* The login type that should be used: popup or redirect
*
* @memberof MgtMsal2Provider
*/
loginType: string;
/**
* The authority to use.
*
* @memberof MgtMsal2Provider
*/
authority: string;
/**
* Comma separated list of scopes
*
* @memberof MgtMsal2Provider
*/
scopes: string;
/**
* The redirect uri to use
*
* @memberof MgtMsal2Provider
*/
redirectUri: string;
/**
* Type of prompt for login
*
* @memberof MgtMsal2Provider
*/
prompt: string;
/**
* Disables incremental consent
*
* @memberof MgtMsal2Provider
*/
isIncrementalConsentDisabled: boolean;
/**
* Disables multiple account capability
*
* @memberof MgtMsal2Provider
*/
isMultiAccountDisabled: any;
/**
* Gets whether this provider can be used in this environment
*
* @readonly
* @memberof MgtMsal2Provider
*/
get isAvailable(): boolean;
/**
* method called to initialize the provider. Each derived class should provide their own implementation.
*
* @protected
* @memberof MgtMsal2Provider
*/
protected initializeProvider(): void;
}
export declare const registerMgtMsal2Provider: () => void;
//# sourceMappingURL=mgt-msal2-provider.d.ts.map

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

import { property } from 'lit/decorators.js';
import { Providers, LoginType, MgtBaseProvider, customElement } from '@microsoft/mgt-element';
import { Providers, LoginType, MgtBaseProvider, registerComponent } from '@microsoft/mgt-element';
import { Msal2Provider, PromptType } from './Msal2Provider';
export const registerMgtMsal2Provider = () => {
registerComponent('msal2-provider', MgtMsal2Provider);
};
/**

@@ -27,3 +30,3 @@ * Authentication Library Provider for Microsoft personal accounts

*/
let MgtMsal2Provider = class MgtMsal2Provider extends MgtBaseProvider {
class MgtMsal2Provider extends MgtBaseProvider {
constructor() {

@@ -103,3 +106,3 @@ super(...arguments);

}
};
}
__decorate([

@@ -172,7 +175,2 @@ property({

], MgtMsal2Provider.prototype, "isMultiAccountDisabled", void 0);
MgtMsal2Provider = __decorate([
customElement('msal2-provider')
// @customElement('mgt-msal2-provider')
], MgtMsal2Provider);
export { MgtMsal2Provider };
//# sourceMappingURL=mgt-msal2-provider.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

@@ -16,3 +16,3 @@ /**

};
import { IProvider, LoginType, ProviderState, createFromProvider } from '@microsoft/mgt-element';
import { IProvider, LoginType, ProviderState, createFromProvider, error } from '@microsoft/mgt-element';
import { PublicClientApplication, InteractionRequiredAuthError } from '@azure/msal-browser';

@@ -23,3 +23,3 @@ /**

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

@@ -109,2 +109,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);

@@ -157,2 +162,3 @@ }

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

@@ -185,3 +191,3 @@ this.ms_config.system = msalConfig.system || {};

catch (e) {
console.error('🦒: Problem attempting to sign in', e);
error('Problem attempting to sign in', e);
throw e;

@@ -272,3 +278,14 @@ }

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 &&
accountToSet &&
activeAccount &&
storedAccount.homeAccountId === accountToSet.homeAccountId &&
activeAccount.homeAccountId === accountToSet.homeAccountId) {
return;
}
this._publicClientApplication.setActiveAccount(accountToSet);
this.setStoredAccount();

@@ -505,3 +522,3 @@ super.setActiveAccount(user);

catch (popUpErr) {
console.error('🦒: problem with pop-up sign in', popUpErr);
error('problem with pop-up sign in', popUpErr);
throw popUpErr;

@@ -508,0 +525,0 @@ }

{
"name": "@microsoft/mgt-msal2-provider",
"version": "3.1.3",
"version": "4.0.0-next.mgt-chat.5c123b0",
"description": "The Microsoft Graph Toolkit Msal 2.0 Provider",

@@ -41,5 +41,9 @@ "keywords": [

},
"sideEffects": [
"./dist/es6/index.js",
"./src/index.ts"
],
"dependencies": {
"@azure/msal-browser": "^2.22.0",
"@microsoft/mgt-element": "3.1.3",
"@microsoft/mgt-element": "4.0.0-next.mgt-chat.5c123b0",
"@microsoft/microsoft-graph-client": "3.0.2"

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

@@ -22,3 +22,3 @@ # Microsoft Graph Toolkit MSAL 2.0 Provider

import {Providers, LoginType} from '@microsoft/mgt-element';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider/dist/es6/exports';

@@ -48,3 +48,3 @@ // initialize the auth provider globally

import {Providers, LoginType} from '@microsoft/mgt-element';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider/dist/es6/exports';
import {PublicClientApplication} from '@azure/msal-browser';

@@ -101,3 +101,3 @@

import {Providers, LoginType} from '@microsoft/mgt-element';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider';
import {Msal2Provider, PromptType} from '@microsoft/mgt-msal2-provider/dist/es6/exports';

@@ -104,0 +104,0 @@ // initialize the auth provider globally

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

*/
export * from './Msal2Provider';
export * from './mgt-msal2-provider';
export * from './exports';

@@ -9,4 +9,9 @@ /**

import { property } from 'lit/decorators.js';
import { Providers, LoginType, MgtBaseProvider, customElement } from '@microsoft/mgt-element';
import { Providers, LoginType, MgtBaseProvider, registerComponent } from '@microsoft/mgt-element';
import { Msal2Config, Msal2Provider, PromptType } from './Msal2Provider';
export const registerMgtMsal2Provider = () => {
registerComponent('msal2-provider', MgtMsal2Provider);
};
/**

@@ -19,5 +24,3 @@ * Authentication Library Provider for Microsoft personal accounts

*/
@customElement('msal2-provider')
// @customElement('mgt-msal2-provider')
export class MgtMsal2Provider extends MgtBaseProvider {
class MgtMsal2Provider extends MgtBaseProvider {
/**

@@ -24,0 +27,0 @@ * String alphanumerical value relation to a specific user

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

IProviderAccount,
GraphEndpoint
GraphEndpoint,
error
} from '@microsoft/mgt-element';

@@ -26,3 +27,5 @@ import {

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

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

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

@@ -392,2 +395,3 @@ export enum PromptType {

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

@@ -421,3 +425,3 @@

} catch (e) {
console.error('🦒: Problem attempting to sign in', e);
error('Problem attempting to sign in', e);
throw e;

@@ -427,2 +431,8 @@ }

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

@@ -505,3 +515,16 @@ * 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 &&
accountToSet &&
activeAccount &&
storedAccount.homeAccountId === accountToSet.homeAccountId &&
activeAccount.homeAccountId === accountToSet.homeAccountId
) {
return;
}
this._publicClientApplication.setActiveAccount(accountToSet);
this.setStoredAccount();

@@ -744,3 +767,3 @@ super.setActiveAccount(user);

} catch (popUpErr) {
console.error('🦒: problem with pop-up sign in', popUpErr);
error('problem with pop-up sign in', popUpErr);
throw popUpErr;

@@ -747,0 +770,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

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