@azure/msal-node
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,17 @@ { | ||
{ | ||
"date": "Wed, 03 Mar 2021 21:47:05 GMT", | ||
"tag": "@azure/msal-node_v1.0.1", | ||
"version": "1.0.1", | ||
"comments": { | ||
"none": [ | ||
{ | ||
"comment": "add a doc for migrating from adal to msal", | ||
"author": "samuel.kamau@microsoft.com", | ||
"commit": "e4b4b1404b4db26fe3e251d2d3169a0fb826133c", | ||
"package": "@azure/msal-node" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 18 Feb 2021 00:34:32 GMT", | ||
@@ -7,0 +22,0 @@ "tag": "@azure/msal-node_v1.0.0", |
@@ -0,0 +0,0 @@ # Change Log - @azure/msal-node |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@azure/msal-common"),r=e(require("axios")),n=require("uuid"),i=e(require("crypto")),o=require("jsonwebtoken");function a(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function c(e){a(o,n,i,c,s,"next",e)}function s(e){a(o,n,i,c,s,"throw",e)}c(void 0)}))}}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var h,l,f=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=Object.create((t&&t.prototype instanceof l?t:l).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=C(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var h={};function l(){}function f(){}function p(){}var d={};d[i]=function(){return this};var g=Object.getPrototypeOf,y=g&&g(g(w([])));y&&y!==t&&r.call(y,i)&&(d=y);var v=p.prototype=l.prototype=Object.create(d);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,c){var s=u(e[i],e,o);if("throw"!==s.type){var h=s.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(l).then((function(e){h.value=e,a(h)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function C(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return f.prototype=v.constructor=p,p.constructor=f,f.displayName=c(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},m(k.prototype),k.prototype[o]=function(){return this},e.AsyncIterator=k,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new k(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(v),c(v,a,"Generator"),v[i]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=w,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(l={exports:{}}),l.exports);!function(e){e.GET="get",e.POST="post"}(h||(h={}));var p,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";!function(e){e[e.acquireTokenSilent=62]="acquireTokenSilent",e[e.acquireTokenByUsernamePassword=371]="acquireTokenByUsernamePassword",e[e.acquireTokenByDeviceCode=671]="acquireTokenByDeviceCode",e[e.acquireTokenByClientCredential=771]="acquireTokenByClientCredential",e[e.acquireTokenByCode=871]="acquireTokenByCode",e[e.acquireTokenByRefreshToken=872]="acquireTokenByRefreshToken"}(p||(p={}));var g=function(){function e(){}var t=e.prototype;return t.sendGetRequestAsync=function(){var e=c(f.mark((function e(t,n){var i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:h.GET,url:t,headers:n&&n.headers,validateStatus:function(){return!0}},e.next=3,r(i);case 3:return e.abrupt("return",{headers:(o=e.sent).headers,body:o.data,status:o.status});case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),t.sendPostRequestAsync=function(){var e=c(f.mark((function e(t,n){var i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:h.POST,url:t,data:n&&n.body||"",headers:n&&n.headers,validateStatus:function(){return!0}},e.next=3,r(i);case 3:return e.abrupt("return",{headers:(o=e.sent).headers,body:o.data,status:o.status});case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),e}(),y={clientId:"",authority:t.Constants.DEFAULT_AUTHORITY,clientSecret:"",clientAssertion:"",clientCertificate:{thumbprint:"",privateKey:"",x5c:""},knownAuthorities:[],cloudDiscoveryMetadata:"",authorityMetadata:"",clientCapabilities:[],protocolMode:t.ProtocolMode.AAD},v={},m={loggerOptions:{loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:t.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new g},e}().getNetworkClient()};function k(e){var t=e.cache,r=e.system;return{auth:s({},y,e.auth),cache:s({},v,t),system:s({},m,r)}}var C=function(){function e(){}return e.generateGuid=function(){return n.v4()},e.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e}(),b=function(){function e(){}return e.base64Encode=function(e,t){return Buffer.from(e,t).toString("base64")},e.base64EncodeUrl=function(t,r){return e.base64Encode(t,r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var r=t.replace(/-/g,"+").replace(/_/g,"/");r.length%4;)r+="=";return e.base64Decode(r)},e}(),T=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){var e=c(f.mark((function e(){var t,r;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.generateCodeVerifier(),r=this.generateCodeChallengeFromVerifier(t),e.abrupt("return",{verifier:t,challenge:r});case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.generateCodeVerifier=function(){var e=i.randomBytes(32),t=this.bufferToCVString(e);return b.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return b.base64EncodeUrl(this.sha256(e).toString("base64"),"base64")},t.sha256=function(e){return i.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],r=0;r<e.byteLength;r+=1)t.push(d[e[r]%d.length]);return t.join("")},e}(),A=function(){function e(){this.pkceGenerator=new T}var t=e.prototype;return t.createNewGuid=function(){return C.generateGuid()},t.base64Encode=function(e){return b.base64Encode(e)},t.base64Decode=function(e){return b.base64Decode(e)},t.generatePkceCodes=function(){return this.pkceGenerator.generatePkceCodes()},t.getPublicKeyThumbprint=function(){throw new Error("Method not implemented.")},t.signJwt=function(){throw new Error("Method not implemented.")},e}(),w=function(){function e(){}return e.deserializeJSONBlob=function(e){return t.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,realm:i.realm,localAccountId:i.local_account_id,username:i.username,authorityType:i.authority_type,name:i.name,clientInfo:i.client_info,lastModificationTime:i.last_modification_time,lastModificationApp:i.last_modification_app},a=new t.AccountEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeIdTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,realm:i.realm},a=new t.IdTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAccessTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,realm:i.realm,target:i.target,cachedAt:i.cached_at,expiresOn:i.expires_on,extendedExpiresOn:i.extended_expires_on,refreshOn:i.refresh_on,keyId:i.key_id,tokenType:i.token_type},a=new t.AccessTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeRefreshTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,familyId:i.family_id,target:i.target,realm:i.realm},a=new t.RefreshTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAppMetadata=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={clientId:i.client_id,environment:i.environment,familyId:i.family_id},a=new t.AppMetadataEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAllCache=function(e){return{accounts:e.Account?this.deserializeAccounts(e.Account):{},idTokens:e.IdToken?this.deserializeIdTokens(e.IdToken):{},accessTokens:e.AccessToken?this.deserializeAccessTokens(e.AccessToken):{},refreshTokens:e.RefreshToken?this.deserializeRefreshTokens(e.RefreshToken):{},appMetadata:e.AppMetadata?this.deserializeAppMetadata(e.AppMetadata):{}}},e}(),x=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,realm:n.realm,local_account_id:n.localAccountId,username:n.username,authority_type:n.authorityType,name:n.name,client_info:n.clientInfo,last_modification_time:n.lastModificationTime,last_modification_app:n.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm,target:n.target,cached_at:n.cachedAt,expires_on:n.expiresOn,extended_expires_on:n.extendedExpiresOn,refresh_on:n.refreshOn,key_id:n.keyId,token_type:n.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,family_id:n.familyId,target:n.target,realm:n.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={client_id:n.clientId,environment:n.environment,family_id:n.familyId}})),t},e.serializeAllCache=function(e){return{Account:this.serializeAccounts(e.accounts),IdToken:this.serializeIdTokens(e.idTokens),AccessToken:this.serializeAccessTokens(e.accessTokens),RefreshToken:this.serializeRefreshTokens(e.refreshTokens),AppMetadata:this.serializeAppMetadata(e.appMetadata)}},e}(),E=function(e){function r(t,r,n){var i;return(i=e.call(this,r,n)||this).cache={},i.changeEmitters=[],i.logger=t,i}u(r,e);var n=r.prototype;return n.registerChangeEmitter=function(e){this.changeEmitters.push(e)},n.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},n.cacheToInMemoryCache=function(e){var r={accounts:{},idTokens:{},accessTokens:{},refreshTokens:{},appMetadata:{}};for(var n in e)if(e[n]instanceof t.AccountEntity)r.accounts[n]=e[n];else if(e[n]instanceof t.IdTokenEntity)r.idTokens[n]=e[n];else if(e[n]instanceof t.AccessTokenEntity)r.accessTokens[n]=e[n];else if(e[n]instanceof t.RefreshTokenEntity)r.refreshTokens[n]=e[n];else{if(!(e[n]instanceof t.AppMetadataEntity))continue;r.appMetadata[n]=e[n]}return r},n.inMemoryCacheToCache=function(e){return this.getCache(),s({},e.accounts,e.idTokens,e.accessTokens,e.refreshTokens,e.appMetadata)},n.getInMemoryCache=function(){return this.logger.verbose("Getting in-memory cache"),this.cacheToInMemoryCache(this.getCache())},n.setInMemoryCache=function(e){this.logger.verbose("Setting in-memory cache");var t=this.inMemoryCacheToCache(e);this.setCache(t),this.emitChange()},n.getCache=function(){return this.logger.verbose("Getting cache key-value store"),this.cache},n.setCache=function(e){this.logger.verbose("Setting cache key value store"),this.cache=e,this.emitChange()},n.getItem=function(e){return this.logger.verbosePii("Item key: "+e),this.getCache()[e]},n.setItem=function(e,t){this.logger.verbosePii("Item key: "+e);var r=this.getCache();r[e]=t,this.setCache(r)},n.getAccount=function(e){var r=this.getItem(e);return t.AccountEntity.isAccountEntity(r)?r:null},n.setAccount=function(e){var t=e.generateAccountKey();this.setItem(t,e)},n.getIdTokenCredential=function(e){var r=this.getItem(e);return t.IdTokenEntity.isIdTokenEntity(r)?r:null},n.setIdTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getAccessTokenCredential=function(e){var r=this.getItem(e);return t.AccessTokenEntity.isAccessTokenEntity(r)?r:null},n.setAccessTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getRefreshTokenCredential=function(e){var r=this.getItem(e);return t.RefreshTokenEntity.isRefreshTokenEntity(r)?r:null},n.setRefreshTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getAppMetadata=function(e){var r=this.getItem(e);return t.AppMetadataEntity.isAppMetadataEntity(e,r)?r:null},n.setAppMetadata=function(e){var t=e.generateAppMetadataKey();this.setItem(t,e)},n.getServerTelemetry=function(e){var r=this.getItem(e);return r&&t.ServerTelemetryEntity.isServerTelemetryEntity(e,r)?r:null},n.setServerTelemetry=function(e,t){this.setItem(e,t)},n.getAuthorityMetadata=function(e){var r=this.getItem(e);return r&&t.AuthorityMetadataEntity.isAuthorityMetadataEntity(e,r)?r:null},n.getAuthorityMetadataKeys=function(){var e=this;return this.getKeys().filter((function(t){return e.isAuthorityMetadata(t)}))},n.setAuthorityMetadata=function(e,t){this.setItem(e,t)},n.getThrottlingCache=function(e){var r=this.getItem(e);return r&&t.ThrottlingEntity.isThrottlingEntity(e,r)?r:null},n.setThrottlingCache=function(e,t){this.setItem(e,t)},n.removeItem=function(e){this.logger.verbosePii("Item key: "+e);var t=!1,r=this.getCache();return r[e]&&(delete r[e],t=!0),t&&(this.setCache(r),this.emitChange()),t},n.containsKey=function(e){return this.getKeys().includes(e)},n.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e))},n.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},r.generateInMemoryCache=function(e){return w.deserializeAllCache(w.deserializeJSONBlob(e))},r.generateJsonCache=function(e){return x.serializeAllCache(e)},r}(t.CacheManager),I={},O={},_={},M={},S={},R=function(){function e(e,t,r){this.cacheHasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),r&&(this.persistence=r),this.logger=t}var r=e.prototype;return r.hasChanged=function(){return this.cacheHasChanged},r.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=x.serializeAllCache(this.storage.getInMemoryCache());return t.StringUtils.isEmpty(this.cacheSnapshot)?this.logger.verbose("No cache snapshot to merge"):(this.logger.verbose("Reading cache snapshot from disk"),e=this.mergeState(JSON.parse(this.cacheSnapshot),e)),this.cacheHasChanged=!1,JSON.stringify(e)},r.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,t.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var r=w.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setInMemoryCache(r)}},r.getKVStore=function(){return this.storage.getCache()},r.getAllAccounts=function(){var e=c(f.mark((function e(){var r;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.verbose("getAllAccounts called"),e.prev=1,!this.persistence){e.next=6;break}return r=new t.TokenCacheContext(this,!1),e.next=6,this.persistence.beforeCacheAccess(r);case 6:return e.abrupt("return",this.storage.getAllAccounts());case 7:if(e.prev=7,!this.persistence||!r){e.next=11;break}return e.next=11,this.persistence.afterCacheAccess(r);case 11:return e.finish(7);case 12:case"end":return e.stop()}}),e,this,[[1,,7,12]])})));return function(){return e.apply(this,arguments)}}(),r.getAccountByHomeId=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAllAccounts();case 2:if(n=e.sent,t.StringUtils.isEmpty(r)||!n||!n.length){e.next=7;break}return e.abrupt("return",n.filter((function(e){return e.homeAccountId===r}))[0]||null);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getAccountByLocalId=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAllAccounts();case 2:if(n=e.sent,t.StringUtils.isEmpty(r)||!n||!n.length){e.next=7;break}return e.abrupt("return",n.filter((function(e){return e.localAccountId===r}))[0]||null);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.removeAccount=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.verbose("removeAccount called"),e.prev=1,!this.persistence){e.next=6;break}return n=new t.TokenCacheContext(this,!0),e.next=6,this.persistence.beforeCacheAccess(n);case 6:this.storage.removeAccount(t.AccountEntity.generateAccountCacheKey(r));case 7:if(e.prev=7,!this.persistence||!n){e.next=11;break}return e.next=11,this.persistence.afterCacheAccess(n);case 11:return e.finish(7);case 12:case"end":return e.stop()}}),e,this,[[1,,7,12]])})));return function(t){return e.apply(this,arguments)}}(),r.handleChangeEvent=function(){this.cacheHasChanged=!0},r.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var r=this.mergeRemovals(e,t);return this.mergeUpdates(r,t)},r.mergeUpdates=function(e,t){var r=this;return Object.keys(t).forEach((function(n){var i=t[n];if(e.hasOwnProperty(n)){var o=null!==i,a="object"==typeof i,c=!Array.isArray(i);o&&a&&c&&null!=e[n]?r.mergeUpdates(e[n],i):e[n]=i}else null!==i&&(e[n]=i)})),e},r.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({},e,{Account:e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata})},r.mergeRemovalsDict=function(e,t){var r=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete r[e]})),r},r.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},I,e.Account),IdToken:s({},O,e.IdToken),AccessToken:s({},_,e.AccessToken),RefreshToken:s({},M,e.RefreshToken),AppMetadata:s({},S,e.AppMetadata)}},e}(),j=function(){function e(e){this.config=k(e),this.cryptoProvider=new A,this.logger=new t.Logger(this.config.system.loggerOptions,"@azure/msal-node","1.0.0"),this.storage=new E(this.logger,this.config.auth.clientId,this.cryptoProvider),this.tokenCache=new R(this.storage,this.logger,this.config.cache.cachePlugin)}var r=e.prototype;return r.getAuthCodeUrl=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("getAuthCodeUrl called"),n=s({},r,this.initializeBaseRequest(r),{responseMode:r.responseMode||t.ResponseMode.QUERY,authenticationScheme:t.AuthenticationScheme.BEARER}),e.next=4,this.buildOauthClientConfiguration(n.authority);case 4:return i=e.sent,this.logger.verbose("Auth client config generated"),o=new t.AuthorizationCodeClient(i),e.abrupt("return",o.getAuthCodeUrl(n));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenByCode=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByCode called"),n=s({},r,this.initializeBaseRequest(r),{authenticationScheme:t.AuthenticationScheme.BEARER}),i=this.initializeServerTelemetryManager(p.acquireTokenByCode,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.AuthorizationCodeClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenByRefreshToken=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByRefreshToken called"),n=s({},r,this.initializeBaseRequest(r),{authenticationScheme:t.AuthenticationScheme.BEARER}),i=this.initializeServerTelemetryManager(p.acquireTokenByRefreshToken,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.RefreshTokenClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenSilent=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s({},r,this.initializeBaseRequest(r),{forceRefresh:r.forceRefresh||!1}),i=this.initializeServerTelemetryManager(p.acquireTokenSilent,n.correlationId,n.forceRefresh),e.prev=2,e.next=5,this.buildOauthClientConfiguration(n.authority,i);case 5:return o=new t.SilentFlowClient(e.sent),e.abrupt("return",o.acquireToken(n));case 10:throw e.prev=10,e.t0=e.catch(2),i.cacheFailedRequest(e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[2,10]])})));return function(t){return e.apply(this,arguments)}}(),r.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},r.getLogger=function(){return this.logger},r.setLogger=function(e){this.logger=e},r.buildOauthClientConfiguration=function(){var e=c(f.mark((function e(t,r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.verbose("buildOauthClientConfiguration called"),e.next=3,this.createAuthority(t);case 3:return e.abrupt("return",{authOptions:{clientId:this.config.auth.clientId,authority:n=e.sent,clientCapabilities:this.config.auth.clientCapabilities},loggerOptions:{loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:this.cryptoProvider,networkInterface:this.config.system.networkClient,storageInterface:this.storage,serverTelemetryManager:r,clientCredentials:{clientSecret:this.clientSecret,clientAssertion:this.clientAssertion?this.getClientAssertion(n):void 0},libraryInfo:{sku:"msal.js.node",version:"1.0.0",cpu:process.arch||"",os:process.platform||""},persistencePlugin:this.config.cache.cachePlugin,serializableCache:this.tokenCache});case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getClientAssertion=function(e){return{assertion:this.clientAssertion.getJwt(this.cryptoProvider,this.config.auth.clientId,e.tokenEndpoint),assertionType:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},r.initializeBaseRequest=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],t.OIDC_DEFAULT_SCOPES),correlationId:e&&e.correlationId||this.cryptoProvider.createNewGuid(),authority:e.authority||this.config.auth.authority})},r.initializeServerTelemetryManager=function(e,r,n){return new t.ServerTelemetryManager({clientId:this.config.auth.clientId,correlationId:r,apiId:e,forceRefresh:n||!1},this.storage)},r.createAuthority=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.verbose("createAuthority called"),n={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},e.next=4,t.AuthorityFactory.createDiscoveredInstance(r,this.config.system.networkClient,this.storage,n);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),e}(),q=function(e){function r(t){return e.call(this,t)||this}u(r,e);var n=r.prototype;return n.acquireTokenByDeviceCode=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByDeviceCode called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByDeviceCode,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.DeviceCodeClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),n.acquireTokenByUsernamePassword=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByUsernamePassword called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByUsernamePassword,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.UsernamePasswordClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r}(j),P=function(){function e(){}e.fromAssertion=function(t){var r=new e;return r.jwt=t,r},e.fromCertificate=function(t,r,n){var i=new e;return i.privateKey=r,i.thumbprint=t,n&&(i.publicCertificate=this.parseCertificate(n)),i};var r=e.prototype;return r.getJwt=function(e,r,n){if(this.privateKey&&this.thumbprint)return this.jwt&&!this.isExpired()&&r===this.issuer&&n===this.jwtAudience?this.jwt:this.createJwt(e,r,n);if(this.jwt)return this.jwt;throw t.ClientAuthError.createInvalidAssertionError()},r.createJwt=function(e,r,n){var i,a;this.issuer=r,this.jwtAudience=n;var c=t.TimeUtils.nowSeconds();this.expirationTime=c+600;var s,u=((i={}).alg="RS256",i.x5t=b.base64EncodeUrl(this.thumbprint,"hex"),i);this.publicCertificate&&Object.assign(u,((s={}).x5c=this.publicCertificate,s));var h=((a={}).aud=this.jwtAudience,a.exp=this.expirationTime,a.iss=this.issuer,a.sub=this.issuer,a.nbf=c,a.jti=e.createNewGuid(),a);return this.jwt=o.sign(h,this.privateKey,{header:u}),this.jwt},r.isExpired=function(){return this.expirationTime<t.TimeUtils.nowSeconds()},e.parseCertificate=function(e){for(var t,r=/\x2D\x2D\x2D\x2D\x2DBEGIN CERTIFICATE\x2D\x2D\x2D\x2D\x2D\n([\s\S]+?)\n\x2D\x2D\x2D\x2D\x2DEND CERTIFICATE\x2D\x2D\x2D\x2D\x2D/g,n=[];null!==(t=r.exec(e));)n.push(t[1].replace(/\n/,""));return n},e}(),z=function(e){function r(t){var r;return(r=e.call(this,t)||this).setClientCredential(r.config),r}u(r,e);var n=r.prototype;return n.acquireTokenByClientCredential=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByClientCredential called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByClientCredential,n.correlationId,n.skipCache),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.ClientCredentialClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),n.acquireTokenOnBehalfOf=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenOnBehalfOf called"),n=s({},r,this.initializeBaseRequest(r)),e.next=4,this.buildOauthClientConfiguration(n.authority);case 4:return i=e.sent,this.logger.verbose("Auth client config generated"),o=new t.OnBehalfOfClient(i),e.abrupt("return",o.acquireToken(n));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.setClientCredential=function(e){var r=!t.StringUtils.isEmpty(e.auth.clientSecret),n=!t.StringUtils.isEmpty(e.auth.clientAssertion),i=e.auth.clientCertificate,o=!t.StringUtils.isEmpty(i.thumbprint)||!t.StringUtils.isEmpty(i.privateKey);if(r&&n||n&&o||r&&o)throw t.ClientAuthError.createInvalidCredentialError();if(r)this.clientSecret=e.auth.clientSecret;else if(n)this.clientAssertion=P.fromAssertion(e.auth.clientAssertion);else{if(!o)throw t.ClientAuthError.createInvalidCredentialError();var a;this.clientAssertion=P.fromCertificate(i.thumbprint,i.privateKey,null==(a=e.auth.clientCertificate)?void 0:a.x5c)}},r}(j);Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return t.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return t.AuthErrorMessage}}),Object.defineProperty(exports,"ClientAuthError",{enumerable:!0,get:function(){return t.ClientAuthError}}),Object.defineProperty(exports,"ClientAuthErrorMessage",{enumerable:!0,get:function(){return t.ClientAuthErrorMessage}}),Object.defineProperty(exports,"ClientConfigurationError",{enumerable:!0,get:function(){return t.ClientConfigurationError}}),Object.defineProperty(exports,"ClientConfigurationErrorMessage",{enumerable:!0,get:function(){return t.ClientConfigurationErrorMessage}}),Object.defineProperty(exports,"InteractionRequiredAuthError",{enumerable:!0,get:function(){return t.InteractionRequiredAuthError}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"Logger",{enumerable:!0,get:function(){return t.Logger}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return t.PromptValue}}),Object.defineProperty(exports,"ProtocolMode",{enumerable:!0,get:function(){return t.ProtocolMode}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return t.ResponseMode}}),Object.defineProperty(exports,"ServerError",{enumerable:!0,get:function(){return t.ServerError}}),Object.defineProperty(exports,"TokenCacheContext",{enumerable:!0,get:function(){return t.TokenCacheContext}}),exports.ClientApplication=j,exports.ClientAssertion=P,exports.ConfidentialClientApplication=z,exports.CryptoProvider=A,exports.NodeStorage=E,exports.PublicClientApplication=q,exports.TokenCache=R,exports.buildAppConfiguration=k; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@azure/msal-common"),r=e(require("axios")),n=require("uuid"),i=e(require("crypto")),o=require("jsonwebtoken");function a(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function c(e){a(o,n,i,c,s,"next",e)}function s(e){a(o,n,i,c,s,"throw",e)}c(void 0)}))}}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var h,l,f=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=Object.create((t&&t.prototype instanceof l?t:l).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=C(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var h={};function l(){}function f(){}function p(){}var d={};d[i]=function(){return this};var g=Object.getPrototypeOf,y=g&&g(g(w([])));y&&y!==t&&r.call(y,i)&&(d=y);var v=p.prototype=l.prototype=Object.create(d);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,c){var s=u(e[i],e,o);if("throw"!==s.type){var h=s.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(l).then((function(e){h.value=e,a(h)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function C(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return f.prototype=v.constructor=p,p.constructor=f,f.displayName=c(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},m(k.prototype),k.prototype[o]=function(){return this},e.AsyncIterator=k,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new k(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(v),c(v,a,"Generator"),v[i]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=w,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(l={exports:{}}),l.exports);!function(e){e.GET="get",e.POST="post"}(h||(h={}));var p,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";!function(e){e[e.acquireTokenSilent=62]="acquireTokenSilent",e[e.acquireTokenByUsernamePassword=371]="acquireTokenByUsernamePassword",e[e.acquireTokenByDeviceCode=671]="acquireTokenByDeviceCode",e[e.acquireTokenByClientCredential=771]="acquireTokenByClientCredential",e[e.acquireTokenByCode=871]="acquireTokenByCode",e[e.acquireTokenByRefreshToken=872]="acquireTokenByRefreshToken"}(p||(p={}));var g=function(){function e(){}var t=e.prototype;return t.sendGetRequestAsync=function(){var e=c(f.mark((function e(t,n){var i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:h.GET,url:t,headers:n&&n.headers,validateStatus:function(){return!0}},e.next=3,r(i);case 3:return e.abrupt("return",{headers:(o=e.sent).headers,body:o.data,status:o.status});case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),t.sendPostRequestAsync=function(){var e=c(f.mark((function e(t,n){var i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:h.POST,url:t,data:n&&n.body||"",headers:n&&n.headers,validateStatus:function(){return!0}},e.next=3,r(i);case 3:return e.abrupt("return",{headers:(o=e.sent).headers,body:o.data,status:o.status});case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),e}(),y={clientId:"",authority:t.Constants.DEFAULT_AUTHORITY,clientSecret:"",clientAssertion:"",clientCertificate:{thumbprint:"",privateKey:"",x5c:""},knownAuthorities:[],cloudDiscoveryMetadata:"",authorityMetadata:"",clientCapabilities:[],protocolMode:t.ProtocolMode.AAD},v={},m={loggerOptions:{loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:t.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new g},e}().getNetworkClient()};function k(e){var t=e.cache,r=e.system;return{auth:s({},y,e.auth),cache:s({},v,t),system:s({},m,r)}}var C=function(){function e(){}return e.generateGuid=function(){return n.v4()},e.isGuid=function(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e}(),b=function(){function e(){}return e.base64Encode=function(e,t){return Buffer.from(e,t).toString("base64")},e.base64EncodeUrl=function(t,r){return e.base64Encode(t,r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var r=t.replace(/-/g,"+").replace(/_/g,"/");r.length%4;)r+="=";return e.base64Decode(r)},e}(),T=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){var e=c(f.mark((function e(){var t,r;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.generateCodeVerifier(),r=this.generateCodeChallengeFromVerifier(t),e.abrupt("return",{verifier:t,challenge:r});case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.generateCodeVerifier=function(){var e=i.randomBytes(32),t=this.bufferToCVString(e);return b.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return b.base64EncodeUrl(this.sha256(e).toString("base64"),"base64")},t.sha256=function(e){return i.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],r=0;r<e.byteLength;r+=1)t.push(d[e[r]%d.length]);return t.join("")},e}(),A=function(){function e(){this.pkceGenerator=new T}var t=e.prototype;return t.createNewGuid=function(){return C.generateGuid()},t.base64Encode=function(e){return b.base64Encode(e)},t.base64Decode=function(e){return b.base64Decode(e)},t.generatePkceCodes=function(){return this.pkceGenerator.generatePkceCodes()},t.getPublicKeyThumbprint=function(){throw new Error("Method not implemented.")},t.signJwt=function(){throw new Error("Method not implemented.")},e}(),w=function(){function e(){}return e.deserializeJSONBlob=function(e){return t.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,realm:i.realm,localAccountId:i.local_account_id,username:i.username,authorityType:i.authority_type,name:i.name,clientInfo:i.client_info,lastModificationTime:i.last_modification_time,lastModificationApp:i.last_modification_app},a=new t.AccountEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeIdTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,realm:i.realm},a=new t.IdTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAccessTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,realm:i.realm,target:i.target,cachedAt:i.cached_at,expiresOn:i.expires_on,extendedExpiresOn:i.extended_expires_on,refreshOn:i.refresh_on,keyId:i.key_id,tokenType:i.token_type},a=new t.AccessTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeRefreshTokens=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={homeAccountId:i.home_account_id,environment:i.environment,credentialType:i.credential_type,clientId:i.client_id,secret:i.secret,familyId:i.family_id,target:i.target,realm:i.realm},a=new t.RefreshTokenEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAppMetadata=function(e){var r={};return e&&Object.keys(e).map((function(n){var i=e[n],o={clientId:i.client_id,environment:i.environment,familyId:i.family_id},a=new t.AppMetadataEntity;t.CacheManager.toObject(a,o),r[n]=a})),r},e.deserializeAllCache=function(e){return{accounts:e.Account?this.deserializeAccounts(e.Account):{},idTokens:e.IdToken?this.deserializeIdTokens(e.IdToken):{},accessTokens:e.AccessToken?this.deserializeAccessTokens(e.AccessToken):{},refreshTokens:e.RefreshToken?this.deserializeRefreshTokens(e.RefreshToken):{},appMetadata:e.AppMetadata?this.deserializeAppMetadata(e.AppMetadata):{}}},e}(),x=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,realm:n.realm,local_account_id:n.localAccountId,username:n.username,authority_type:n.authorityType,name:n.name,client_info:n.clientInfo,last_modification_time:n.lastModificationTime,last_modification_app:n.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,realm:n.realm,target:n.target,cached_at:n.cachedAt,expires_on:n.expiresOn,extended_expires_on:n.extendedExpiresOn,refresh_on:n.refreshOn,key_id:n.keyId,token_type:n.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={home_account_id:n.homeAccountId,environment:n.environment,credential_type:n.credentialType,client_id:n.clientId,secret:n.secret,family_id:n.familyId,target:n.target,realm:n.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(r){var n=e[r];t[r]={client_id:n.clientId,environment:n.environment,family_id:n.familyId}})),t},e.serializeAllCache=function(e){return{Account:this.serializeAccounts(e.accounts),IdToken:this.serializeIdTokens(e.idTokens),AccessToken:this.serializeAccessTokens(e.accessTokens),RefreshToken:this.serializeRefreshTokens(e.refreshTokens),AppMetadata:this.serializeAppMetadata(e.appMetadata)}},e}(),E=function(e){function r(t,r,n){var i;return(i=e.call(this,r,n)||this).cache={},i.changeEmitters=[],i.logger=t,i}u(r,e);var n=r.prototype;return n.registerChangeEmitter=function(e){this.changeEmitters.push(e)},n.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},n.cacheToInMemoryCache=function(e){var r={accounts:{},idTokens:{},accessTokens:{},refreshTokens:{},appMetadata:{}};for(var n in e)if(e[n]instanceof t.AccountEntity)r.accounts[n]=e[n];else if(e[n]instanceof t.IdTokenEntity)r.idTokens[n]=e[n];else if(e[n]instanceof t.AccessTokenEntity)r.accessTokens[n]=e[n];else if(e[n]instanceof t.RefreshTokenEntity)r.refreshTokens[n]=e[n];else{if(!(e[n]instanceof t.AppMetadataEntity))continue;r.appMetadata[n]=e[n]}return r},n.inMemoryCacheToCache=function(e){return this.getCache(),s({},e.accounts,e.idTokens,e.accessTokens,e.refreshTokens,e.appMetadata)},n.getInMemoryCache=function(){return this.logger.verbose("Getting in-memory cache"),this.cacheToInMemoryCache(this.getCache())},n.setInMemoryCache=function(e){this.logger.verbose("Setting in-memory cache");var t=this.inMemoryCacheToCache(e);this.setCache(t),this.emitChange()},n.getCache=function(){return this.logger.verbose("Getting cache key-value store"),this.cache},n.setCache=function(e){this.logger.verbose("Setting cache key value store"),this.cache=e,this.emitChange()},n.getItem=function(e){return this.logger.verbosePii("Item key: "+e),this.getCache()[e]},n.setItem=function(e,t){this.logger.verbosePii("Item key: "+e);var r=this.getCache();r[e]=t,this.setCache(r)},n.getAccount=function(e){var r=this.getItem(e);return t.AccountEntity.isAccountEntity(r)?r:null},n.setAccount=function(e){var t=e.generateAccountKey();this.setItem(t,e)},n.getIdTokenCredential=function(e){var r=this.getItem(e);return t.IdTokenEntity.isIdTokenEntity(r)?r:null},n.setIdTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getAccessTokenCredential=function(e){var r=this.getItem(e);return t.AccessTokenEntity.isAccessTokenEntity(r)?r:null},n.setAccessTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getRefreshTokenCredential=function(e){var r=this.getItem(e);return t.RefreshTokenEntity.isRefreshTokenEntity(r)?r:null},n.setRefreshTokenCredential=function(e){var t=e.generateCredentialKey();this.setItem(t,e)},n.getAppMetadata=function(e){var r=this.getItem(e);return t.AppMetadataEntity.isAppMetadataEntity(e,r)?r:null},n.setAppMetadata=function(e){var t=e.generateAppMetadataKey();this.setItem(t,e)},n.getServerTelemetry=function(e){var r=this.getItem(e);return r&&t.ServerTelemetryEntity.isServerTelemetryEntity(e,r)?r:null},n.setServerTelemetry=function(e,t){this.setItem(e,t)},n.getAuthorityMetadata=function(e){var r=this.getItem(e);return r&&t.AuthorityMetadataEntity.isAuthorityMetadataEntity(e,r)?r:null},n.getAuthorityMetadataKeys=function(){var e=this;return this.getKeys().filter((function(t){return e.isAuthorityMetadata(t)}))},n.setAuthorityMetadata=function(e,t){this.setItem(e,t)},n.getThrottlingCache=function(e){var r=this.getItem(e);return r&&t.ThrottlingEntity.isThrottlingEntity(e,r)?r:null},n.setThrottlingCache=function(e,t){this.setItem(e,t)},n.removeItem=function(e){this.logger.verbosePii("Item key: "+e);var t=!1,r=this.getCache();return r[e]&&(delete r[e],t=!0),t&&(this.setCache(r),this.emitChange()),t},n.containsKey=function(e){return this.getKeys().includes(e)},n.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e))},n.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},r.generateInMemoryCache=function(e){return w.deserializeAllCache(w.deserializeJSONBlob(e))},r.generateJsonCache=function(e){return x.serializeAllCache(e)},r}(t.CacheManager),I={},O={},_={},M={},S={},R=function(){function e(e,t,r){this.cacheHasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),r&&(this.persistence=r),this.logger=t}var r=e.prototype;return r.hasChanged=function(){return this.cacheHasChanged},r.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=x.serializeAllCache(this.storage.getInMemoryCache());return t.StringUtils.isEmpty(this.cacheSnapshot)?this.logger.verbose("No cache snapshot to merge"):(this.logger.verbose("Reading cache snapshot from disk"),e=this.mergeState(JSON.parse(this.cacheSnapshot),e)),this.cacheHasChanged=!1,JSON.stringify(e)},r.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,t.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var r=w.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setInMemoryCache(r)}},r.getKVStore=function(){return this.storage.getCache()},r.getAllAccounts=function(){var e=c(f.mark((function e(){var r;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.verbose("getAllAccounts called"),e.prev=1,!this.persistence){e.next=6;break}return r=new t.TokenCacheContext(this,!1),e.next=6,this.persistence.beforeCacheAccess(r);case 6:return e.abrupt("return",this.storage.getAllAccounts());case 7:if(e.prev=7,!this.persistence||!r){e.next=11;break}return e.next=11,this.persistence.afterCacheAccess(r);case 11:return e.finish(7);case 12:case"end":return e.stop()}}),e,this,[[1,,7,12]])})));return function(){return e.apply(this,arguments)}}(),r.getAccountByHomeId=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAllAccounts();case 2:if(n=e.sent,t.StringUtils.isEmpty(r)||!n||!n.length){e.next=7;break}return e.abrupt("return",n.filter((function(e){return e.homeAccountId===r}))[0]||null);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getAccountByLocalId=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAllAccounts();case 2:if(n=e.sent,t.StringUtils.isEmpty(r)||!n||!n.length){e.next=7;break}return e.abrupt("return",n.filter((function(e){return e.localAccountId===r}))[0]||null);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.removeAccount=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.verbose("removeAccount called"),e.prev=1,!this.persistence){e.next=6;break}return n=new t.TokenCacheContext(this,!0),e.next=6,this.persistence.beforeCacheAccess(n);case 6:this.storage.removeAccount(t.AccountEntity.generateAccountCacheKey(r));case 7:if(e.prev=7,!this.persistence||!n){e.next=11;break}return e.next=11,this.persistence.afterCacheAccess(n);case 11:return e.finish(7);case 12:case"end":return e.stop()}}),e,this,[[1,,7,12]])})));return function(t){return e.apply(this,arguments)}}(),r.handleChangeEvent=function(){this.cacheHasChanged=!0},r.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var r=this.mergeRemovals(e,t);return this.mergeUpdates(r,t)},r.mergeUpdates=function(e,t){var r=this;return Object.keys(t).forEach((function(n){var i=t[n];if(e.hasOwnProperty(n)){var o=null!==i,a="object"==typeof i,c=!Array.isArray(i);o&&a&&c&&null!=e[n]?r.mergeUpdates(e[n],i):e[n]=i}else null!==i&&(e[n]=i)})),e},r.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({},e,{Account:e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata})},r.mergeRemovalsDict=function(e,t){var r=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete r[e]})),r},r.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},I,e.Account),IdToken:s({},O,e.IdToken),AccessToken:s({},_,e.AccessToken),RefreshToken:s({},M,e.RefreshToken),AppMetadata:s({},S,e.AppMetadata)}},e}(),j=function(){function e(e){this.config=k(e),this.cryptoProvider=new A,this.logger=new t.Logger(this.config.system.loggerOptions,"@azure/msal-node","1.0.1"),this.storage=new E(this.logger,this.config.auth.clientId,this.cryptoProvider),this.tokenCache=new R(this.storage,this.logger,this.config.cache.cachePlugin)}var r=e.prototype;return r.getAuthCodeUrl=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("getAuthCodeUrl called"),n=s({},r,this.initializeBaseRequest(r),{responseMode:r.responseMode||t.ResponseMode.QUERY,authenticationScheme:t.AuthenticationScheme.BEARER}),e.next=4,this.buildOauthClientConfiguration(n.authority);case 4:return i=e.sent,this.logger.verbose("Auth client config generated"),o=new t.AuthorizationCodeClient(i),e.abrupt("return",o.getAuthCodeUrl(n));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenByCode=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByCode called"),n=s({},r,this.initializeBaseRequest(r),{authenticationScheme:t.AuthenticationScheme.BEARER}),i=this.initializeServerTelemetryManager(p.acquireTokenByCode,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.AuthorizationCodeClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenByRefreshToken=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByRefreshToken called"),n=s({},r,this.initializeBaseRequest(r),{authenticationScheme:t.AuthenticationScheme.BEARER}),i=this.initializeServerTelemetryManager(p.acquireTokenByRefreshToken,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.RefreshTokenClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r.acquireTokenSilent=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s({},r,this.initializeBaseRequest(r),{forceRefresh:r.forceRefresh||!1}),i=this.initializeServerTelemetryManager(p.acquireTokenSilent,n.correlationId,n.forceRefresh),e.prev=2,e.next=5,this.buildOauthClientConfiguration(n.authority,i);case 5:return o=new t.SilentFlowClient(e.sent),e.abrupt("return",o.acquireToken(n));case 10:throw e.prev=10,e.t0=e.catch(2),i.cacheFailedRequest(e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[2,10]])})));return function(t){return e.apply(this,arguments)}}(),r.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},r.getLogger=function(){return this.logger},r.setLogger=function(e){this.logger=e},r.buildOauthClientConfiguration=function(){var e=c(f.mark((function e(t,r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.verbose("buildOauthClientConfiguration called"),e.next=3,this.createAuthority(t);case 3:return e.abrupt("return",{authOptions:{clientId:this.config.auth.clientId,authority:n=e.sent,clientCapabilities:this.config.auth.clientCapabilities},loggerOptions:{loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:this.cryptoProvider,networkInterface:this.config.system.networkClient,storageInterface:this.storage,serverTelemetryManager:r,clientCredentials:{clientSecret:this.clientSecret,clientAssertion:this.clientAssertion?this.getClientAssertion(n):void 0},libraryInfo:{sku:"msal.js.node",version:"1.0.1",cpu:process.arch||"",os:process.platform||""},persistencePlugin:this.config.cache.cachePlugin,serializableCache:this.tokenCache});case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getClientAssertion=function(e){return{assertion:this.clientAssertion.getJwt(this.cryptoProvider,this.config.auth.clientId,e.tokenEndpoint),assertionType:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},r.initializeBaseRequest=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],t.OIDC_DEFAULT_SCOPES),correlationId:e&&e.correlationId||this.cryptoProvider.createNewGuid(),authority:e.authority||this.config.auth.authority})},r.initializeServerTelemetryManager=function(e,r,n){return new t.ServerTelemetryManager({clientId:this.config.auth.clientId,correlationId:r,apiId:e,forceRefresh:n||!1},this.storage)},r.createAuthority=function(){var e=c(f.mark((function e(r){var n;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.verbose("createAuthority called"),n={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},e.next=4,t.AuthorityFactory.createDiscoveredInstance(r,this.config.system.networkClient,this.storage,n);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),e}(),q=function(e){function r(t){return e.call(this,t)||this}u(r,e);var n=r.prototype;return n.acquireTokenByDeviceCode=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByDeviceCode called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByDeviceCode,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.DeviceCodeClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),n.acquireTokenByUsernamePassword=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByUsernamePassword called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByUsernamePassword,n.correlationId),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.UsernamePasswordClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),r}(j),P=function(){function e(){}e.fromAssertion=function(t){var r=new e;return r.jwt=t,r},e.fromCertificate=function(t,r,n){var i=new e;return i.privateKey=r,i.thumbprint=t,n&&(i.publicCertificate=this.parseCertificate(n)),i};var r=e.prototype;return r.getJwt=function(e,r,n){if(this.privateKey&&this.thumbprint)return this.jwt&&!this.isExpired()&&r===this.issuer&&n===this.jwtAudience?this.jwt:this.createJwt(e,r,n);if(this.jwt)return this.jwt;throw t.ClientAuthError.createInvalidAssertionError()},r.createJwt=function(e,r,n){var i,a;this.issuer=r,this.jwtAudience=n;var c=t.TimeUtils.nowSeconds();this.expirationTime=c+600;var s,u=((i={}).alg="RS256",i.x5t=b.base64EncodeUrl(this.thumbprint,"hex"),i);this.publicCertificate&&Object.assign(u,((s={}).x5c=this.publicCertificate,s));var h=((a={}).aud=this.jwtAudience,a.exp=this.expirationTime,a.iss=this.issuer,a.sub=this.issuer,a.nbf=c,a.jti=e.createNewGuid(),a);return this.jwt=o.sign(h,this.privateKey,{header:u}),this.jwt},r.isExpired=function(){return this.expirationTime<t.TimeUtils.nowSeconds()},e.parseCertificate=function(e){for(var t,r=/\x2D\x2D\x2D\x2D\x2DBEGIN CERTIFICATE\x2D\x2D\x2D\x2D\x2D\n([\s\S]+?)\n\x2D\x2D\x2D\x2D\x2DEND CERTIFICATE\x2D\x2D\x2D\x2D\x2D/g,n=[];null!==(t=r.exec(e));)n.push(t[1].replace(/\n/,""));return n},e}(),z=function(e){function r(t){var r;return(r=e.call(this,t)||this).setClientCredential(r.config),r}u(r,e);var n=r.prototype;return n.acquireTokenByClientCredential=function(){var e=c(f.mark((function e(r){var n,i,o,a;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenByClientCredential called"),n=s({},r,this.initializeBaseRequest(r)),i=this.initializeServerTelemetryManager(p.acquireTokenByClientCredential,n.correlationId,n.skipCache),e.prev=3,e.next=6,this.buildOauthClientConfiguration(n.authority,i);case 6:return o=e.sent,this.logger.verbose("Auth client config generated"),a=new t.ClientCredentialClient(o),e.abrupt("return",a.acquireToken(n));case 12:throw e.prev=12,e.t0=e.catch(3),i.cacheFailedRequest(e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),n.acquireTokenOnBehalfOf=function(){var e=c(f.mark((function e(r){var n,i,o;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("acquireTokenOnBehalfOf called"),n=s({},r,this.initializeBaseRequest(r)),e.next=4,this.buildOauthClientConfiguration(n.authority);case 4:return i=e.sent,this.logger.verbose("Auth client config generated"),o=new t.OnBehalfOfClient(i),e.abrupt("return",o.acquireToken(n));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.setClientCredential=function(e){var r=!t.StringUtils.isEmpty(e.auth.clientSecret),n=!t.StringUtils.isEmpty(e.auth.clientAssertion),i=e.auth.clientCertificate,o=!t.StringUtils.isEmpty(i.thumbprint)||!t.StringUtils.isEmpty(i.privateKey);if(r&&n||n&&o||r&&o)throw t.ClientAuthError.createInvalidCredentialError();if(r)this.clientSecret=e.auth.clientSecret;else if(n)this.clientAssertion=P.fromAssertion(e.auth.clientAssertion);else{if(!o)throw t.ClientAuthError.createInvalidCredentialError();var a;this.clientAssertion=P.fromCertificate(i.thumbprint,i.privateKey,null==(a=e.auth.clientCertificate)?void 0:a.x5c)}},r}(j);Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return t.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return t.AuthErrorMessage}}),Object.defineProperty(exports,"ClientAuthError",{enumerable:!0,get:function(){return t.ClientAuthError}}),Object.defineProperty(exports,"ClientAuthErrorMessage",{enumerable:!0,get:function(){return t.ClientAuthErrorMessage}}),Object.defineProperty(exports,"ClientConfigurationError",{enumerable:!0,get:function(){return t.ClientConfigurationError}}),Object.defineProperty(exports,"ClientConfigurationErrorMessage",{enumerable:!0,get:function(){return t.ClientConfigurationErrorMessage}}),Object.defineProperty(exports,"InteractionRequiredAuthError",{enumerable:!0,get:function(){return t.InteractionRequiredAuthError}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"Logger",{enumerable:!0,get:function(){return t.Logger}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return t.PromptValue}}),Object.defineProperty(exports,"ProtocolMode",{enumerable:!0,get:function(){return t.ProtocolMode}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return t.ResponseMode}}),Object.defineProperty(exports,"ServerError",{enumerable:!0,get:function(){return t.ServerError}}),Object.defineProperty(exports,"TokenCacheContext",{enumerable:!0,get:function(){return t.TokenCacheContext}}),exports.ClientApplication=j,exports.ClientAssertion=P,exports.ConfidentialClientApplication=z,exports.CryptoProvider=A,exports.NodeStorage=E,exports.PublicClientApplication=q,exports.TokenCache=R,exports.buildAppConfiguration=k; | ||
//# sourceMappingURL=msal-node.cjs.production.min.js.map |
export declare const name = "@azure/msal-node"; | ||
export declare const version = "1.0.0"; | ||
export declare const version = "1.0.1"; | ||
//# sourceMappingURL=packageMetadata.d.ts.map |
{ | ||
"name": "@azure/msal-node", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -69,3 +69,3 @@ "name": "Microsoft", | ||
"dependencies": { | ||
"@azure/msal-common": "^4.0.1", | ||
"@azure/msal-common": "^4.0.2", | ||
"axios": "^0.21.1", | ||
@@ -72,0 +72,0 @@ "jsonwebtoken": "^8.5.1", |
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 not supported yet
Sorry, the diff of this file is too big to display
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
911163
7843
Updated@azure/msal-common@^4.0.2