@microsoft/mgt-msal2-provider
Advanced tools
Comparing version 2.3.0-next.build21.b0a0338 to 2.3.0-next.teamsprovider.525dfc2
@@ -29,13 +29,13 @@ /** | ||
/** | ||
* Comma separated list of scopes | ||
* The authority to use. | ||
* | ||
* @memberof MgtMsalProvider | ||
*/ | ||
scopes: any; | ||
authority: any; | ||
/** | ||
* The authority to use. | ||
* Comma separated list of scopes | ||
* | ||
* @memberof MgtMsalProvider | ||
*/ | ||
authority: any; | ||
scopes: any; | ||
/** | ||
@@ -54,8 +54,2 @@ * The redirect uri to use | ||
/** | ||
* Disables multiple account capability | ||
* | ||
* @memberof MgtMsal2Provider | ||
*/ | ||
isMultiAccountDisabled: any; | ||
/** | ||
* Gets whether this provider can be used in this environment | ||
@@ -62,0 +56,0 @@ * |
@@ -79,10 +79,2 @@ /** | ||
} | ||
if (this.prompt) { | ||
let prompt = this.prompt.toUpperCase(); | ||
const promptEnum = PromptType[prompt]; | ||
config.prompt = promptEnum; | ||
} | ||
if (this.isMultiAccountDisabled) { | ||
config.isMultiAccountDisabled = true; | ||
} | ||
this.provider = new Msal2Provider(config); | ||
@@ -108,2 +100,6 @@ Providers.globalProvider = this.provider; | ||
__decorate([ | ||
property(), | ||
__metadata("design:type", Object) | ||
], MgtMsal2Provider.prototype, "authority", void 0); | ||
__decorate([ | ||
property({ | ||
@@ -117,9 +113,2 @@ attribute: 'scopes', | ||
property({ | ||
attribute: 'authority', | ||
type: String | ||
}), | ||
__metadata("design:type", Object) | ||
], MgtMsal2Provider.prototype, "authority", void 0); | ||
__decorate([ | ||
property({ | ||
attribute: 'redirect-uri', | ||
@@ -137,9 +126,2 @@ type: String | ||
], MgtMsal2Provider.prototype, "prompt", void 0); | ||
__decorate([ | ||
property({ | ||
attribute: 'multi-account-disabled', | ||
type: Boolean | ||
}), | ||
__metadata("design:type", Object) | ||
], MgtMsal2Provider.prototype, "isMultiAccountDisabled", void 0); | ||
MgtMsal2Provider = __decorate([ | ||
@@ -146,0 +128,0 @@ customElement('mgt-msal2-provider') |
@@ -54,9 +54,2 @@ import { IProvider, LoginType, IProviderAccount } from '@microsoft/mgt-element'; | ||
/** | ||
* Redirect URI | ||
* | ||
* @type {string} | ||
* @memberof Msal2Config | ||
*/ | ||
redirectUri?: string; | ||
/** | ||
* Prompt type | ||
@@ -69,3 +62,3 @@ * | ||
/** | ||
* Authority URL | ||
* Redirect URI | ||
* | ||
@@ -75,10 +68,10 @@ * @type {string} | ||
*/ | ||
authority?: string; | ||
redirectUri?: string; | ||
/** | ||
* Disable multi account functionality | ||
* Authority URL | ||
* | ||
* @type {boolean} | ||
* @type {string} | ||
* @memberof Msal2Config | ||
*/ | ||
isMultiAccountDisabled?: boolean; | ||
authority?: string; | ||
/** | ||
@@ -179,11 +172,2 @@ * Other options | ||
scopes: string[]; | ||
/** | ||
* | ||
* Disables multi account functionality | ||
* @private | ||
* @type {boolean} | ||
* @memberof Msal2Provider | ||
*/ | ||
private _isMultipleAccountDisabled; | ||
get isMultiAccountSupported(): boolean; | ||
private sessionStorageRequestedScopesKey; | ||
@@ -229,9 +213,2 @@ private sessionStorageDeniedScopesKey; | ||
/** | ||
* Gets active account | ||
* | ||
* @return {*} | ||
* @memberof Msal2Provider | ||
*/ | ||
getActiveAccount(): IProviderAccount; | ||
/** | ||
* Once a succesful login occurs, set the active account and store it | ||
@@ -238,0 +215,0 @@ * |
@@ -34,10 +34,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
super(); | ||
/** | ||
* | ||
* Disables multi account functionality | ||
* @private | ||
* @type {boolean} | ||
* @memberof Msal2Provider | ||
*/ | ||
this._isMultipleAccountDisabled = false; | ||
this.sessionStorageRequestedScopesKey = 'mgt-requested-scopes'; | ||
@@ -67,5 +59,2 @@ this.sessionStorageDeniedScopesKey = 'mgt-denied-scopes'; | ||
} | ||
get isMultiAccountSupported() { | ||
return !this._isMultipleAccountDisabled; | ||
} | ||
/** | ||
@@ -108,4 +97,2 @@ * Initialize provider with configuration details | ||
this._prompt = typeof config.prompt !== 'undefined' ? config.prompt : PromptType.SELECT_ACCOUNT; | ||
this._isMultipleAccountDisabled = | ||
typeof config.isMultiAccountDisabled !== 'undefined' ? config.isMultiAccountDisabled : false; | ||
this.graph = createFromProvider(this); | ||
@@ -200,3 +187,3 @@ try { | ||
this._publicClientApplication.getAllAccounts().forEach((account) => { | ||
usernames.push({ name: account.name, mail: account.username, id: account.homeAccountId }); | ||
usernames.push({ username: account.username, id: account.homeAccountId }); | ||
}); | ||
@@ -217,12 +204,2 @@ return usernames; | ||
/** | ||
* Gets active account | ||
* | ||
* @return {*} | ||
* @memberof Msal2Provider | ||
*/ | ||
getActiveAccount() { | ||
const account = this._publicClientApplication.getActiveAccount(); | ||
return { name: account.name, mail: account.username, id: account.homeAccountId }; | ||
} | ||
/** | ||
* Once a succesful login occurs, set the active account and store it | ||
@@ -236,5 +213,4 @@ * | ||
this.setActiveAccount({ | ||
name: account.name, | ||
id: account.homeAccountId, | ||
mail: account.username | ||
username: account.name, | ||
id: account.homeAccountId | ||
}); | ||
@@ -385,8 +361,3 @@ this.setState(ProviderState.SignedIn); | ||
yield this._publicClientApplication.logoutPopup(Object.assign({}, logOutRequest)); | ||
if (this._publicClientApplication.getAllAccounts.length == 1 || this._isMultipleAccountDisabled) { | ||
this.setState(ProviderState.SignedOut); | ||
} | ||
else { | ||
this.trySilentSignIn(); | ||
} | ||
this.setState(ProviderState.SignedOut); | ||
} | ||
@@ -393,0 +364,0 @@ }); |
{ | ||
"name": "@microsoft/mgt-msal2-provider", | ||
"version": "2.3.0-next.build21.b0a0338", | ||
"version": "2.3.0-next.teamsprovider.525dfc2", | ||
"description": "The Microsoft Graph Toolkit Msal 2.0 Provider", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@microsoft/mgt-element": "2.3.0-next.build21.b0a0338", | ||
"@microsoft/mgt-element": "2.3.0-next.teamsprovider.525dfc2", | ||
"@microsoft/microsoft-graph-client": "^2.2.1", | ||
@@ -45,0 +45,0 @@ "@azure/msal-browser": "^2.14.1" |
@@ -43,14 +43,10 @@ /** | ||
/** | ||
* Comma separated list of scopes | ||
* The authority to use. | ||
* | ||
* @memberof MgtMsalProvider | ||
*/ | ||
@property({ | ||
attribute: 'scopes', | ||
type: String | ||
}) | ||
public scopes; | ||
@property() public authority; | ||
/** | ||
* The authority to use. | ||
* Comma separated list of scopes | ||
* | ||
@@ -60,6 +56,6 @@ * @memberof MgtMsalProvider | ||
@property({ | ||
attribute: 'authority', | ||
attribute: 'scopes', | ||
type: String | ||
}) | ||
public authority; | ||
public scopes; | ||
@@ -89,13 +85,2 @@ /** | ||
/** | ||
* Disables multiple account capability | ||
* | ||
* @memberof MgtMsal2Provider | ||
*/ | ||
@property({ | ||
attribute: 'multi-account-disabled', | ||
type: Boolean | ||
}) | ||
public isMultiAccountDisabled; | ||
/** | ||
* Gets whether this provider can be used in this environment | ||
@@ -150,11 +135,2 @@ * | ||
if (this.prompt) { | ||
let prompt: string = this.prompt.toUpperCase(); | ||
const promptEnum = PromptType[prompt]; | ||
config.prompt = promptEnum; | ||
} | ||
if (this.isMultiAccountDisabled) { | ||
config.isMultiAccountDisabled = true; | ||
} | ||
this.provider = new Msal2Provider(config); | ||
@@ -161,0 +137,0 @@ Providers.globalProvider = this.provider; |
@@ -78,10 +78,2 @@ import { | ||
/** | ||
* Redirect URI | ||
* | ||
* @type {string} | ||
* @memberof Msal2Config | ||
*/ | ||
redirectUri?: string; | ||
/** | ||
* Prompt type | ||
@@ -95,3 +87,3 @@ * | ||
/** | ||
* Authority URL | ||
* Redirect URI | ||
* | ||
@@ -101,11 +93,11 @@ * @type {string} | ||
*/ | ||
authority?: string; | ||
redirectUri?: string; | ||
/** | ||
* Disable multi account functionality | ||
* Authority URL | ||
* | ||
* @type {boolean} | ||
* @type {string} | ||
* @memberof Msal2Config | ||
*/ | ||
isMultiAccountDisabled?: boolean; | ||
authority?: string; | ||
@@ -223,14 +215,2 @@ /** | ||
/** | ||
* | ||
* Disables multi account functionality | ||
* @private | ||
* @type {boolean} | ||
* @memberof Msal2Provider | ||
*/ | ||
private _isMultipleAccountDisabled: boolean = false; | ||
public get isMultiAccountSupported(): boolean { | ||
return !this._isMultipleAccountDisabled; | ||
} | ||
private sessionStorageRequestedScopesKey = 'mgt-requested-scopes'; | ||
@@ -285,4 +265,2 @@ private sessionStorageDeniedScopesKey = 'mgt-denied-scopes'; | ||
this._prompt = typeof config.prompt !== 'undefined' ? config.prompt : PromptType.SELECT_ACCOUNT; | ||
this._isMultipleAccountDisabled = | ||
typeof config.isMultiAccountDisabled !== 'undefined' ? config.isMultiAccountDisabled : false; | ||
this.graph = createFromProvider(this); | ||
@@ -369,3 +347,3 @@ try { | ||
this._publicClientApplication.getAllAccounts().forEach((account: AccountInfo) => { | ||
usernames.push({ name: account.name, mail: account.username, id: account.homeAccountId } as IProviderAccount); | ||
usernames.push({ username: account.username, id: account.homeAccountId } as IProviderAccount); | ||
}); | ||
@@ -388,13 +366,2 @@ return usernames; | ||
/** | ||
* Gets active account | ||
* | ||
* @return {*} | ||
* @memberof Msal2Provider | ||
*/ | ||
public getActiveAccount() { | ||
const account = this._publicClientApplication.getActiveAccount(); | ||
return { name: account.name, mail: account.username, id: account.homeAccountId } as IProviderAccount; | ||
} | ||
/** | ||
* Once a succesful login occurs, set the active account and store it | ||
@@ -408,5 +375,4 @@ * | ||
this.setActiveAccount({ | ||
name: account.name, | ||
id: account.homeAccountId, | ||
mail: account.username | ||
username: account.name, | ||
id: account.homeAccountId | ||
} as IProviderAccount); | ||
@@ -570,7 +536,3 @@ this.setState(ProviderState.SignedIn); | ||
await this._publicClientApplication.logoutPopup({ ...logOutRequest }); | ||
if (this._publicClientApplication.getAllAccounts.length == 1 || this._isMultipleAccountDisabled) { | ||
this.setState(ProviderState.SignedOut); | ||
} else { | ||
this.trySilentSignIn(); | ||
} | ||
this.setState(ProviderState.SignedOut); | ||
} | ||
@@ -577,0 +539,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
918920
1553
+ Added@microsoft/mgt-element@2.3.0-next.teamsprovider.525dfc2(transitive)
- Removed@microsoft/mgt-element@2.3.0-next.build21.b0a0338(transitive)
Updated@microsoft/mgt-element@2.3.0-next.teamsprovider.525dfc2