cordova-plugin-msal
Advanced tools
Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "cordova-plugin-msal", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "A Cordova plugin providing a wrapper for Microsoft's MSAL library for Android and iOS.", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -1,68 +0,64 @@ | ||
cordova.define("cordova-plugin-msal.msalPlugin", function(require, exports, module) { | ||
module.exports = { | ||
msalInit: function(successCallback, errorCallback, options) { | ||
var defaultOptions = { | ||
authorities: [ | ||
{ | ||
type: 'AAD', | ||
audience: 'AzureADandPersonalMicrosoftAccount', | ||
authorityUrl: '', | ||
cloudInstance: 'MSALAzurePublicCloudInstance', | ||
default: true | ||
} | ||
], | ||
authorizationUserAgent: 'DEFAULT', | ||
multipleCloudsSupported: false, | ||
brokerRedirectUri: false, | ||
accountMode: 'SINGLE', | ||
scopes: ['User.Read'] | ||
} | ||
if (!options) { | ||
options = defaultOptions; | ||
} else { | ||
if (typeof(options.authorities) == 'undefined') { | ||
options.authorities = defaultOptions.authorities; | ||
module.exports = { | ||
msalInit: function(successCallback, errorCallback, options) { | ||
var defaultOptions = { | ||
authorities: [ | ||
{ | ||
type: 'AAD', | ||
audience: 'AzureADandPersonalMicrosoftAccount', | ||
authorityUrl: '', | ||
cloudInstance: 'MSALAzurePublicCloudInstance', | ||
default: true | ||
} | ||
if (typeof(options.authorizationUserAgent) == 'undefined') { | ||
options.authorizationUserAgent = defaultOptions.authorizationUserAgent; | ||
} | ||
if (typeof(options.multipleCloudsSupported) == 'undefined') { | ||
options.multipleCloudsSupported = defaultOptions.multipleCloudsSupported; | ||
} | ||
if (typeof(options.brokerRedirectUri) == 'undefined') { | ||
options.brokerRedirectUri = defaultOptions.brokerRedirectUri; | ||
} | ||
if (typeof(options.accountMode) == 'undefined') { | ||
options.accountMode = defaultOptions.accountMode; | ||
} | ||
if (typeof(options.scopes) == 'undefined') { | ||
options.scopes = defaultOptions.scopes; | ||
} | ||
], | ||
authorizationUserAgent: 'DEFAULT', | ||
multipleCloudsSupported: false, | ||
brokerRedirectUri: false, | ||
accountMode: 'SINGLE', | ||
scopes: ['User.Read'] | ||
} | ||
if (!options) { | ||
options = defaultOptions; | ||
} else { | ||
if (typeof(options.authorities) == 'undefined') { | ||
options.authorities = defaultOptions.authorities; | ||
} | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'msalInit', [JSON.stringify(options)]); | ||
}, | ||
getAccounts: function(successCallback, errorCallback) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'getAccounts', []); | ||
}, | ||
signInSilent: function(successCallback, errorCallback, account) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signInSilent', [account]); | ||
}, | ||
signInInteractive: function(successCallback, errorCallback, signInOptions) { | ||
if (typeof(signInOptions) === 'undefined') { | ||
signInOptions = {}; | ||
if (typeof(options.authorizationUserAgent) == 'undefined') { | ||
options.authorizationUserAgent = defaultOptions.authorizationUserAgent; | ||
} | ||
var opts = [ | ||
typeof(signInOptions.loginHint !== 'undefined') ? signInOptions.loginHint : '', | ||
typeof(signInOptions.prompt !== 'undefined') ? signInOptions.prompt : '', | ||
typeof(signInOptions.authorizationQueryStringParameters) !== 'undefined' ? signInOptions.authorizationQueryStringParameters : [], | ||
typeof(signInOptions.otherScopesToAuthorize) !== 'undefined' ? signInOptions.otherScopesToAuthorize : [] | ||
]; | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signInInteractive', opts); | ||
}, | ||
signOut: function(successCallback, errorCallback, account) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signOut', [account]); | ||
if (typeof(options.multipleCloudsSupported) == 'undefined') { | ||
options.multipleCloudsSupported = defaultOptions.multipleCloudsSupported; | ||
} | ||
if (typeof(options.brokerRedirectUri) == 'undefined') { | ||
options.brokerRedirectUri = defaultOptions.brokerRedirectUri; | ||
} | ||
if (typeof(options.accountMode) == 'undefined') { | ||
options.accountMode = defaultOptions.accountMode; | ||
} | ||
if (typeof(options.scopes) == 'undefined') { | ||
options.scopes = defaultOptions.scopes; | ||
} | ||
} | ||
}; | ||
}); | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'msalInit', [JSON.stringify(options)]); | ||
}, | ||
getAccounts: function(successCallback, errorCallback) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'getAccounts', []); | ||
}, | ||
signInSilent: function(successCallback, errorCallback, account) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signInSilent', [account]); | ||
}, | ||
signInInteractive: function(successCallback, errorCallback, signInOptions) { | ||
if (typeof(signInOptions) === 'undefined') { | ||
signInOptions = {}; | ||
} | ||
var opts = [ | ||
typeof(signInOptions.loginHint !== 'undefined') ? signInOptions.loginHint : '', | ||
typeof(signInOptions.prompt !== 'undefined') ? signInOptions.prompt : '', | ||
typeof(signInOptions.authorizationQueryStringParameters) !== 'undefined' ? signInOptions.authorizationQueryStringParameters : [], | ||
typeof(signInOptions.otherScopesToAuthorize) !== 'undefined' ? signInOptions.otherScopesToAuthorize : [] | ||
]; | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signInInteractive', opts); | ||
}, | ||
signOut: function(successCallback, errorCallback, account) { | ||
cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'signOut', [account]); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
6968436
488