@azure/msal-node
Advanced tools
Comparing version 1.0.0-alpha.10 to 1.0.0-alpha.11
@@ -5,2 +5,17 @@ { | ||
{ | ||
"date": "Thu, 15 Oct 2020 00:49:18 GMT", | ||
"tag": "@azure/msal-node_v1.0.0-alpha.11", | ||
"version": "1.0.0-alpha.11", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"comment": "Export all \"Request\" types in msal-node", | ||
"author": "sameera.gajjarapu@microsoft.com", | ||
"commit": "145602c7ced2c9f77a249f0abdca76f3358bd7db", | ||
"package": "@azure/msal-node" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 14 Oct 2020 23:45:07 GMT", | ||
@@ -7,0 +22,0 @@ "tag": "@azure/msal-node_v1.0.0-alpha.10", |
# Change Log - @azure/msal-node | ||
This log was last generated on Wed, 14 Oct 2020 23:45:07 GMT and should not be manually modified. | ||
This log was last generated on Thu, 15 Oct 2020 00:49:18 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 1.0.0-alpha.11 | ||
Thu, 15 Oct 2020 00:49:18 GMT | ||
### Changes | ||
- Export all "Request" types in msal-node (sameera.gajjarapu@microsoft.com) | ||
## 1.0.0-alpha.10 | ||
@@ -8,0 +16,0 @@ |
@@ -7,2 +7,2 @@ export { PublicClientApplication } from "./client/PublicClientApplication"; | ||
export { CryptoProvider } from "./crypto/CryptoProvider"; | ||
export { AuthorizationCodeRequest, DeviceCodeRequest, RefreshTokenRequest, PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, InteractionRequiredAuthError, ServerError, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, INetworkModule, NetworkRequestOptions, NetworkResponse, LogLevel, ICachePlugin, TokenCacheContext, ISerializableTokenCache } from "@azure/msal-common"; | ||
export { AuthorizationCodeRequest, AuthorizationUrlRequest, SilentFlowRequest, DeviceCodeRequest, RefreshTokenRequest, ClientCredentialRequest, OnBehalfOfRequest, PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, InteractionRequiredAuthError, ServerError, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, INetworkModule, NetworkRequestOptions, NetworkResponse, LogLevel, ICachePlugin, TokenCacheContext, ISerializableTokenCache } from "@azure/msal-common"; |
@@ -1351,3 +1351,3 @@ 'use strict'; | ||
var version = "1.0.0-alpha.10"; | ||
var version = "1.0.0-alpha.11"; | ||
@@ -1354,0 +1354,0 @@ var ClientApplication = /*#__PURE__*/function () { |
@@ -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,n=require("@azure/msal-common"),r=e(require("axios")),i=e(require("debug")),o=require("uuid"),a=e(require("crypto")),c=require("jsonwebtoken");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function l(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function h(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator"))),function(e){e.GET="get",e.POST="post"}(t||(t={}));var f,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";!function(e){e[e.acquireTokenSilent=62]="acquireTokenSilent",e[e.acquireTokenByCode=871]="acquireTokenByCode",e[e.acquireTokenByRefreshToken=872]="acquireTokenByRefreshToken",e[e.acquireTokenByDeviceCode=671]="acquireTokenByDeviceCode",e[e.acquireTokenByClientCredential=771]="acquireTokenByClientCredential"}(f||(f={}));var g=function(){function e(){r.defaults.validateStatus=function(){return!0}}var n=e.prototype;return n.sendGetRequestAsync=function(e,n){try{return Promise.resolve(r({method:t.GET,url:e,headers:n&&n.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},n.sendPostRequestAsync=function(e,n){try{return Promise.resolve(r({method:t.POST,url:e,data:n&&n.body||"",headers:n&&n.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},e}(),m={clientId:"",authority:"",clientSecret:"",clientAssertion:"",clientCertificate:{thumbprint:"",privateKey:""},knownAuthorities:[],cloudDiscoveryMetadata:"",clientCapabilities:[]},p={},y={loggerOptions:{loggerCallback:function(e,t,r){i("msal:"+n.LogLevel[e]+(r?"-Pii":""))(t)},piiLoggingEnabled:!1,logLevel:n.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new g},e}().getNetworkClient()};function v(e){var t=e.cache,n=e.system;return{auth:s({},m,{},e.auth),cache:s({},p,{},t),system:s({},y,{},n)}}var C=function(){function e(){}return e.generateGuid=function(){return o.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}(),k=function(){function e(){}return e.base64Encode=function(e,t){return Buffer.from(e,t).toString("base64")},e.base64EncodeUrl=function(t,n){return e.base64Encode(t,n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var n=t.replace(/-/g,"+").replace(/_/g,"/");n.length%4;)n+="=";return e.base64Decode(n)},e}(),b=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){try{var e=this.generateCodeVerifier(),t=this.generateCodeChallengeFromVerifier(e);return Promise.resolve({verifier:e,challenge:t})}catch(e){return Promise.reject(e)}},t.generateCodeVerifier=function(){var e=a.randomBytes(32),t=this.bufferToCVString(e);return k.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return k.base64EncodeUrl(this.sha256(e).toString("ascii"))},t.sha256=function(e){return a.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],n=0;n<e.byteLength;n+=1)t.push(d[e[n]%d.length]);return t.join("")},e}(),T=function(){function e(){this.pkceGenerator=new b}var t=e.prototype;return t.createNewGuid=function(){return C.generateGuid()},t.base64Encode=function(e){return k.base64Encode(e)},t.base64Decode=function(e){return k.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}(),A=function(){function e(){}return e.deserializeJSONBlob=function(e){return n.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.AccountEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeIdTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.IdTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeAccessTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.AccessTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeRefreshTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.RefreshTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeAppMetadata=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],o={clientId:i.client_id,environment:i.environment,familyId:i.family_id},a=new n.AppMetadataEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},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}(),I=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,realm:r.realm,local_account_id:r.localAccountId,username:r.username,authority_type:r.authorityType,name:r.name,client_info:r.clientInfo,last_modification_time:r.lastModificationTime,last_modification_app:r.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm,target:r.target,cached_at:r.cachedAt,expires_on:r.expiresOn,extended_expires_on:r.extendedExpiresOn,refresh_on:r.refreshOn,key_id:r.keyId,token_type:r.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,family_id:r.familyId,target:r.target,realm:r.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={client_id:r.clientId,environment:r.environment,family_id:r.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}(),O=function(e){function t(t){var n;return(n=e.call(this)||this).cache={},n.changeEmitters=[],n.logger=t,n}u(t,e);var r=t.prototype;return r.registerChangeEmitter=function(e){this.changeEmitters.push(e)},r.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},r.cacheToInMemoryCache=function(e){var t={accounts:{},idTokens:{},accessTokens:{},refreshTokens:{},appMetadata:{}};for(var r in e)if(e[r]instanceof n.AccountEntity)t.accounts[r]=e[r];else if(e[r]instanceof n.IdTokenEntity)t.idTokens[r]=e[r];else if(e[r]instanceof n.AccessTokenEntity)t.accessTokens[r]=e[r];else if(e[r]instanceof n.RefreshTokenEntity)t.refreshTokens[r]=e[r];else{if(!(e[r]instanceof n.AppMetadataEntity))continue;t.appMetadata[r]=e[r]}return t},r.inMemoryCacheToCache=function(e){return this.getCache(),s({},e.accounts,{},e.idTokens,{},e.accessTokens,{},e.refreshTokens,{},e.appMetadata)},r.getInMemoryCache=function(){return this.logger.verbose("Getting in-memory cache"),this.cacheToInMemoryCache(this.getCache())},r.setInMemoryCache=function(e){this.logger.verbose("Setting in-memory cache");var t=this.inMemoryCacheToCache(e);this.setCache(t),this.emitChange()},r.getCache=function(){return this.logger.verbose("Getting cache key-value store"),this.cache},r.setCache=function(e){this.logger.verbose("Setting cache key value store"),this.cache=e,this.emitChange()},r.setItem=function(e,t){this.logger.verbosePii("Item key: "+e);var n=this.getCache();n[e]=t,this.setCache(n)},r.getItem=function(e){return this.logger.verbosePii("Item key: "+e),this.getCache()[e]},r.removeItem=function(e){this.logger.verbosePii("Item key: "+e);var t=!1,n=this.getCache();return n[e]&&(delete n[e],t=!0),t&&(this.setCache(n),this.emitChange()),t},r.containsKey=function(e){return this.getKeys().includes(e)},r.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e))},r.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},t.generateInMemoryCache=function(e){return A.deserializeAllCache(A.deserializeJSONBlob(e))},t.generateJsonCache=function(e){return I.serializeAllCache(e)},t}(n.CacheManager),E={},P={},_={},w={},S={},j=function(){function e(e,t,n){this.cacheHasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),n&&(this.persistence=n),this.logger=t}var t=e.prototype;return t.hasChanged=function(){return this.cacheHasChanged},t.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=I.serializeAllCache(this.storage.getInMemoryCache());return n.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)},t.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,n.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var t=A.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setInMemoryCache(t)}},t.getAllAccounts=function(){try{var e,t=this;return t.logger.verbose("getAllAccounts called"),Promise.resolve(h((function(){function r(){return t.storage.getAllAccounts()}var i=function(){if(t.persistence)return e=new n.TokenCacheContext(t,!1),Promise.resolve(t.persistence.beforeCacheAccess(e)).then((function(){}))}();return i&&i.then?i.then(r):r()}),(function(n,r){function i(){if(n)throw r;return r}var o=function(){if(t.persistence&&e)return Promise.resolve(t.persistence.afterCacheAccess(e)).then((function(){}))}();return o&&o.then?o.then(i):i()})))}catch(e){return Promise.reject(e)}},t.removeAccount=function(e){try{var t,r=this;r.logger.verbose("removeAccount called");var i=h((function(){function i(){r.storage.removeAccount(n.AccountEntity.generateAccountCacheKey(e))}var o=function(){if(r.persistence)return t=new n.TokenCacheContext(r,!0),Promise.resolve(r.persistence.beforeCacheAccess(t)).then((function(){}))}();return o&&o.then?o.then(i):i()}),(function(e,n){function i(){if(e)throw n;return n}var o=function(){if(r.persistence&&t)return Promise.resolve(r.persistence.afterCacheAccess(t)).then((function(){}))}();return o&&o.then?o.then(i):i()}));return Promise.resolve(i&&i.then?i.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},t.handleChangeEvent=function(){this.cacheHasChanged=!0},t.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var n=this.mergeRemovals(e,t);return this.mergeUpdates(n,t)},t.mergeUpdates=function(e,t){var n=this;return Object.keys(t).forEach((function(r){var i=t[r];if(e.hasOwnProperty(r)){var o=null!==i,a="object"==typeof i,c=!Array.isArray(i);o&&a&&c&&null!=e[r]?n.mergeUpdates(e[r],i):e[r]=i}else null!==i&&(e[r]=i)})),e},t.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({},e,{Account:null!=e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:null!=e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:null!=e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:null!=e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:null!=e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata})},t.mergeRemovalsDict=function(e,t){var n=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete n[e]})),n},t.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},E,{},e.Account),IdToken:s({},P,{},e.IdToken),AccessToken:s({},_,{},e.AccessToken),RefreshToken:s({},w,{},e.RefreshToken),AppMetadata:s({},S,{},e.AppMetadata)}},e}(),M=function(){function e(e){this.config=v(e),this.logger=new n.Logger(this.config.system.loggerOptions),this.storage=new O(this.logger),this.tokenCache=new j(this.storage,this.logger,this.config.cache.cachePlugin),this.cryptoProvider=new T,n.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities,this.config.auth.cloudDiscoveryMetadata)}var t,r=e.prototype;return r.getAuthCodeUrl=function(e){try{var t=this;return t.logger.info("getAuthCodeUrl called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.AuthorizationCodeClient(r).getAuthCodeUrl(t.initializeRequest(e))}))}catch(e){return Promise.reject(e)}},r.acquireTokenByCode=function(e){try{var t=this;t.logger.info("acquireTokenByCode called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByCode,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.AuthorizationCodeClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenByRefreshToken=function(e){try{var t=this;t.logger.info("acquireTokenByRefreshToken called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByRefreshToken,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.RefreshTokenClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenSilent=function(e){try{var t=this,r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenSilent,r.correlationId,r.forceRefresh);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return new n.SilentFlowClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},r.buildOauthClientConfiguration=function(e,t){try{var n=this;n.logger.verbose("buildOauthClientConfiguration called");var r=n.config.auth.clientId;return Promise.resolve(n.createAuthority(e)).then((function(e){return{authOptions:{clientId:r,authority:e,knownAuthorities:n.config.auth.knownAuthorities,cloudDiscoveryMetadata:n.config.auth.cloudDiscoveryMetadata,clientCapabilities:n.config.auth.clientCapabilities},loggerOptions:{loggerCallback:n.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:n.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:n.cryptoProvider,networkInterface:n.config.system.networkClient,storageInterface:n.storage,serverTelemetryManager:t,clientCredentials:{clientSecret:n.clientSecret,clientAssertion:n.clientAssertion?n.getClientAssertion():void 0},libraryInfo:{sku:"msal.js.node",version:"1.0.0-alpha.10",cpu:process.arch||"",os:process.platform||""},persistencePlugin:n.config.cache.cachePlugin,serializableCache:n.tokenCache}}))}catch(e){return Promise.reject(e)}},r.getClientAssertion=function(){return{assertion:this.clientAssertion.getJwt(this.cryptoProvider,this.config.auth.clientId,this._authority.tokenEndpoint),assertionType:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},r.initializeRequest=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],[n.Constants.OPENID_SCOPE,n.Constants.PROFILE_SCOPE,n.Constants.OFFLINE_ACCESS_SCOPE]),correlationId:e&&e.correlationId||this.cryptoProvider.createNewGuid()})},r.initializeServerTelemetryManager=function(e,t,r){return new n.ServerTelemetryManager({clientId:this.config.auth.clientId,correlationId:t,apiId:e,forceRefresh:r||!1},this.storage)},r.createAuthority=function(e){try{var t;return this.logger.verbose("createAuthority called"),e?(this.logger.verbose("Authority passed in, creating authority instance"),t=n.AuthorityFactory.createInstance(e,this.config.system.networkClient)):(this.logger.verbose("No authority passed in request, defaulting to authority set on application object"),t=this.authority),t.discoveryComplete()?Promise.resolve(t):Promise.resolve(l((function(){return Promise.resolve(t.resolveEndpointsAsync()).then((function(){return t}))}),(function(e){throw n.ClientAuthError.createEndpointDiscoveryIncompleteError(e)})))}catch(e){return Promise.reject(e)}},(t=[{key:"authority",get:function(){return this._authority||(this._authority=n.AuthorityFactory.createInstance(this.config.auth.authority||n.Constants.DEFAULT_AUTHORITY,this.config.system.networkClient)),this._authority}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}(),R=function(e){function t(t){return e.call(this,t)||this}return u(t,e),t.prototype.acquireTokenByDeviceCode=function(e){try{var t=this;t.logger.info("acquireTokenByDeviceCode called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByDeviceCode,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.DeviceCodeClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},t}(M),q=function(){function e(){}e.fromAssertion=function(t){var n=new e;return n.jwt=t,n},e.fromCertificate=function(t,n){var r=new e;return r.privateKey=n,r.thumbprint=t,r};var t=e.prototype;return t.getJwt=function(e,t,r){if(null!=this.privateKey&&null!=this.thumbprint)return null==this.jwt||this.isExpired()||t!=this.issuer||r!=this.jwtAudience?this.createJwt(e,t,r):this.jwt;if(null!=this.jwt)return this.jwt;throw n.ClientAuthError.createInvalidAssertionError()},t.createJwt=function(e,t,r){var i,o;this.issuer=t,this.jwtAudience=r;var a=n.TimeUtils.nowSeconds();this.expirationTime=a+600;var s=((i={}).alg="RS256",i.x5t=k.base64EncodeUrl(this.thumbprint,"hex"),i),u=((o={}).aud=this.jwtAudience,o.exp=this.expirationTime,o.iss=this.issuer,o.sub=this.issuer,o.nbf=a,o.jti=e.createNewGuid(),o);return this.jwt=c.sign(u,this.privateKey,{header:s}),this.jwt},t.isExpired=function(){return this.expirationTime<n.TimeUtils.nowSeconds()},e}(),z=function(e){function t(t){var n;return(n=e.call(this,t)||this).setClientCredential(n.config),n}u(t,e);var r=t.prototype;return r.acquireTokenByClientCredential=function(e){try{var t=this;t.logger.info("acquireTokenByClientCredential called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByClientCredential,r.correlationId,r.skipCache);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.ClientCredentialClient(r).acquireToken(e)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenOnBehalfOf=function(e){try{var t=this;return t.logger.info("acquireTokenOnBehalfOf called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.OnBehalfOfClient(r).acquireToken(t.initializeRequest(e))}))}catch(e){return Promise.reject(e)}},r.setClientCredential=function(e){var t=!n.StringUtils.isEmpty(e.auth.clientSecret),r=!n.StringUtils.isEmpty(e.auth.clientAssertion),i=e.auth.clientCertificate,o=!n.StringUtils.isEmpty(i.thumbprint)||!n.StringUtils.isEmpty(i.privateKey);if(t&&r||r&&o||t&&o)throw n.ClientAuthError.createInvalidCredentialError();if(t)this.clientSecret=e.auth.clientSecret;else if(r)this.clientAssertion=q.fromAssertion(e.auth.clientAssertion);else{if(!o)throw n.ClientAuthError.createInvalidCredentialError();this.clientAssertion=q.fromCertificate(i.thumbprint,i.privateKey)}},t}(M);Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return n.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return n.AuthErrorMessage}}),Object.defineProperty(exports,"ClientAuthError",{enumerable:!0,get:function(){return n.ClientAuthError}}),Object.defineProperty(exports,"ClientAuthErrorMessage",{enumerable:!0,get:function(){return n.ClientAuthErrorMessage}}),Object.defineProperty(exports,"ClientConfigurationError",{enumerable:!0,get:function(){return n.ClientConfigurationError}}),Object.defineProperty(exports,"ClientConfigurationErrorMessage",{enumerable:!0,get:function(){return n.ClientConfigurationErrorMessage}}),Object.defineProperty(exports,"InteractionRequiredAuthError",{enumerable:!0,get:function(){return n.InteractionRequiredAuthError}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return n.LogLevel}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return n.PromptValue}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return n.ResponseMode}}),Object.defineProperty(exports,"ServerError",{enumerable:!0,get:function(){return n.ServerError}}),Object.defineProperty(exports,"TokenCacheContext",{enumerable:!0,get:function(){return n.TokenCacheContext}}),exports.ConfidentialClientApplication=z,exports.CryptoProvider=T,exports.PublicClientApplication=R,exports.Storage=O,exports.TokenCache=j,exports.buildAppConfiguration=v; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,n=require("@azure/msal-common"),r=e(require("axios")),i=e(require("debug")),o=require("uuid"),a=e(require("crypto")),c=require("jsonwebtoken");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function l(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function h(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator"))),function(e){e.GET="get",e.POST="post"}(t||(t={}));var f,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";!function(e){e[e.acquireTokenSilent=62]="acquireTokenSilent",e[e.acquireTokenByCode=871]="acquireTokenByCode",e[e.acquireTokenByRefreshToken=872]="acquireTokenByRefreshToken",e[e.acquireTokenByDeviceCode=671]="acquireTokenByDeviceCode",e[e.acquireTokenByClientCredential=771]="acquireTokenByClientCredential"}(f||(f={}));var g=function(){function e(){r.defaults.validateStatus=function(){return!0}}var n=e.prototype;return n.sendGetRequestAsync=function(e,n){try{return Promise.resolve(r({method:t.GET,url:e,headers:n&&n.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},n.sendPostRequestAsync=function(e,n){try{return Promise.resolve(r({method:t.POST,url:e,data:n&&n.body||"",headers:n&&n.headers})).then((function(e){return{headers:e.headers,body:e.data,status:e.status}}))}catch(e){return Promise.reject(e)}},e}(),m={clientId:"",authority:"",clientSecret:"",clientAssertion:"",clientCertificate:{thumbprint:"",privateKey:""},knownAuthorities:[],cloudDiscoveryMetadata:"",clientCapabilities:[]},p={},y={loggerOptions:{loggerCallback:function(e,t,r){i("msal:"+n.LogLevel[e]+(r?"-Pii":""))(t)},piiLoggingEnabled:!1,logLevel:n.LogLevel.Info},networkClient:function(){function e(){}return e.getNetworkClient=function(){return new g},e}().getNetworkClient()};function v(e){var t=e.cache,n=e.system;return{auth:s({},m,{},e.auth),cache:s({},p,{},t),system:s({},y,{},n)}}var C=function(){function e(){}return e.generateGuid=function(){return o.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}(),k=function(){function e(){}return e.base64Encode=function(e,t){return Buffer.from(e,t).toString("base64")},e.base64EncodeUrl=function(t,n){return e.base64Encode(t,n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.base64Decode=function(e){return Buffer.from(e,"base64").toString("utf8")},e.base64DecodeUrl=function(t){for(var n=t.replace(/-/g,"+").replace(/_/g,"/");n.length%4;)n+="=";return e.base64Decode(n)},e}(),b=function(){function e(){}var t=e.prototype;return t.generatePkceCodes=function(){try{var e=this.generateCodeVerifier(),t=this.generateCodeChallengeFromVerifier(e);return Promise.resolve({verifier:e,challenge:t})}catch(e){return Promise.reject(e)}},t.generateCodeVerifier=function(){var e=a.randomBytes(32),t=this.bufferToCVString(e);return k.base64EncodeUrl(t)},t.generateCodeChallengeFromVerifier=function(e){return k.base64EncodeUrl(this.sha256(e).toString("ascii"))},t.sha256=function(e){return a.createHash("sha256").update(e).digest()},t.bufferToCVString=function(e){for(var t=[],n=0;n<e.byteLength;n+=1)t.push(d[e[n]%d.length]);return t.join("")},e}(),T=function(){function e(){this.pkceGenerator=new b}var t=e.prototype;return t.createNewGuid=function(){return C.generateGuid()},t.base64Encode=function(e){return k.base64Encode(e)},t.base64Decode=function(e){return k.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}(),A=function(){function e(){}return e.deserializeJSONBlob=function(e){return n.StringUtils.isEmpty(e)?{}:JSON.parse(e)},e.deserializeAccounts=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.AccountEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeIdTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.IdTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeAccessTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.AccessTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeRefreshTokens=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],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 n.RefreshTokenEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},e.deserializeAppMetadata=function(e){var t={};return e&&Object.keys(e).map((function(r){var i=e[r],o={clientId:i.client_id,environment:i.environment,familyId:i.family_id},a=new n.AppMetadataEntity;n.CacheManager.toObject(a,o),t[r]=a})),t},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}(),I=function(){function e(){}return e.serializeJSONBlob=function(e){return JSON.stringify(e)},e.serializeAccounts=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,realm:r.realm,local_account_id:r.localAccountId,username:r.username,authority_type:r.authorityType,name:r.name,client_info:r.clientInfo,last_modification_time:r.lastModificationTime,last_modification_app:r.lastModificationApp}})),t},e.serializeIdTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm}})),t},e.serializeAccessTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,realm:r.realm,target:r.target,cached_at:r.cachedAt,expires_on:r.expiresOn,extended_expires_on:r.extendedExpiresOn,refresh_on:r.refreshOn,key_id:r.keyId,token_type:r.tokenType}})),t},e.serializeRefreshTokens=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={home_account_id:r.homeAccountId,environment:r.environment,credential_type:r.credentialType,client_id:r.clientId,secret:r.secret,family_id:r.familyId,target:r.target,realm:r.realm}})),t},e.serializeAppMetadata=function(e){var t={};return Object.keys(e).map((function(n){var r=e[n];t[n]={client_id:r.clientId,environment:r.environment,family_id:r.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}(),O=function(e){function t(t){var n;return(n=e.call(this)||this).cache={},n.changeEmitters=[],n.logger=t,n}u(t,e);var r=t.prototype;return r.registerChangeEmitter=function(e){this.changeEmitters.push(e)},r.emitChange=function(){this.changeEmitters.forEach((function(e){return e.call(null)}))},r.cacheToInMemoryCache=function(e){var t={accounts:{},idTokens:{},accessTokens:{},refreshTokens:{},appMetadata:{}};for(var r in e)if(e[r]instanceof n.AccountEntity)t.accounts[r]=e[r];else if(e[r]instanceof n.IdTokenEntity)t.idTokens[r]=e[r];else if(e[r]instanceof n.AccessTokenEntity)t.accessTokens[r]=e[r];else if(e[r]instanceof n.RefreshTokenEntity)t.refreshTokens[r]=e[r];else{if(!(e[r]instanceof n.AppMetadataEntity))continue;t.appMetadata[r]=e[r]}return t},r.inMemoryCacheToCache=function(e){return this.getCache(),s({},e.accounts,{},e.idTokens,{},e.accessTokens,{},e.refreshTokens,{},e.appMetadata)},r.getInMemoryCache=function(){return this.logger.verbose("Getting in-memory cache"),this.cacheToInMemoryCache(this.getCache())},r.setInMemoryCache=function(e){this.logger.verbose("Setting in-memory cache");var t=this.inMemoryCacheToCache(e);this.setCache(t),this.emitChange()},r.getCache=function(){return this.logger.verbose("Getting cache key-value store"),this.cache},r.setCache=function(e){this.logger.verbose("Setting cache key value store"),this.cache=e,this.emitChange()},r.setItem=function(e,t){this.logger.verbosePii("Item key: "+e);var n=this.getCache();n[e]=t,this.setCache(n)},r.getItem=function(e){return this.logger.verbosePii("Item key: "+e),this.getCache()[e]},r.removeItem=function(e){this.logger.verbosePii("Item key: "+e);var t=!1,n=this.getCache();return n[e]&&(delete n[e],t=!0),t&&(this.setCache(n),this.emitChange()),t},r.containsKey=function(e){return this.getKeys().includes(e)},r.getKeys=function(){this.logger.verbose("Retrieving all cache keys");var e=this.getCache();return[].concat(Object.keys(e))},r.clear=function(){var e=this;this.logger.verbose("Clearing cache entries created by MSAL"),this.getKeys().forEach((function(t){e.removeItem(t)})),this.emitChange()},t.generateInMemoryCache=function(e){return A.deserializeAllCache(A.deserializeJSONBlob(e))},t.generateJsonCache=function(e){return I.serializeAllCache(e)},t}(n.CacheManager),E={},P={},_={},w={},S={},j=function(){function e(e,t,n){this.cacheHasChanged=!1,this.storage=e,this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this)),n&&(this.persistence=n),this.logger=t}var t=e.prototype;return t.hasChanged=function(){return this.cacheHasChanged},t.serialize=function(){this.logger.verbose("Serializing in-memory cache");var e=I.serializeAllCache(this.storage.getInMemoryCache());return n.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)},t.deserialize=function(e){if(this.logger.verbose("Deserializing JSON to in-memory cache"),this.cacheSnapshot=e,n.StringUtils.isEmpty(this.cacheSnapshot))this.logger.verbose("No cache snapshot to deserialize");else{this.logger.verbose("Reading cache snapshot from disk");var t=A.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));this.storage.setInMemoryCache(t)}},t.getAllAccounts=function(){try{var e,t=this;return t.logger.verbose("getAllAccounts called"),Promise.resolve(h((function(){function r(){return t.storage.getAllAccounts()}var i=function(){if(t.persistence)return e=new n.TokenCacheContext(t,!1),Promise.resolve(t.persistence.beforeCacheAccess(e)).then((function(){}))}();return i&&i.then?i.then(r):r()}),(function(n,r){function i(){if(n)throw r;return r}var o=function(){if(t.persistence&&e)return Promise.resolve(t.persistence.afterCacheAccess(e)).then((function(){}))}();return o&&o.then?o.then(i):i()})))}catch(e){return Promise.reject(e)}},t.removeAccount=function(e){try{var t,r=this;r.logger.verbose("removeAccount called");var i=h((function(){function i(){r.storage.removeAccount(n.AccountEntity.generateAccountCacheKey(e))}var o=function(){if(r.persistence)return t=new n.TokenCacheContext(r,!0),Promise.resolve(r.persistence.beforeCacheAccess(t)).then((function(){}))}();return o&&o.then?o.then(i):i()}),(function(e,n){function i(){if(e)throw n;return n}var o=function(){if(r.persistence&&t)return Promise.resolve(r.persistence.afterCacheAccess(t)).then((function(){}))}();return o&&o.then?o.then(i):i()}));return Promise.resolve(i&&i.then?i.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},t.handleChangeEvent=function(){this.cacheHasChanged=!0},t.mergeState=function(e,t){this.logger.verbose("Merging in-memory cache with cache snapshot");var n=this.mergeRemovals(e,t);return this.mergeUpdates(n,t)},t.mergeUpdates=function(e,t){var n=this;return Object.keys(t).forEach((function(r){var i=t[r];if(e.hasOwnProperty(r)){var o=null!==i,a="object"==typeof i,c=!Array.isArray(i);o&&a&&c&&null!=e[r]?n.mergeUpdates(e[r],i):e[r]=i}else null!==i&&(e[r]=i)})),e},t.mergeRemovals=function(e,t){return this.logger.verbose("Remove updated entries in cache"),s({},e,{Account:null!=e.Account?this.mergeRemovalsDict(e.Account,t.Account):e.Account,AccessToken:null!=e.AccessToken?this.mergeRemovalsDict(e.AccessToken,t.AccessToken):e.AccessToken,RefreshToken:null!=e.RefreshToken?this.mergeRemovalsDict(e.RefreshToken,t.RefreshToken):e.RefreshToken,IdToken:null!=e.IdToken?this.mergeRemovalsDict(e.IdToken,t.IdToken):e.IdToken,AppMetadata:null!=e.AppMetadata?this.mergeRemovalsDict(e.AppMetadata,t.AppMetadata):e.AppMetadata})},t.mergeRemovalsDict=function(e,t){var n=s({},e);return Object.keys(e).forEach((function(e){t&&t.hasOwnProperty(e)||delete n[e]})),n},t.overlayDefaults=function(e){return this.logger.verbose("Overlaying input cache with the default cache"),{Account:s({},E,{},e.Account),IdToken:s({},P,{},e.IdToken),AccessToken:s({},_,{},e.AccessToken),RefreshToken:s({},w,{},e.RefreshToken),AppMetadata:s({},S,{},e.AppMetadata)}},e}(),M=function(){function e(e){this.config=v(e),this.logger=new n.Logger(this.config.system.loggerOptions),this.storage=new O(this.logger),this.tokenCache=new j(this.storage,this.logger,this.config.cache.cachePlugin),this.cryptoProvider=new T,n.TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities,this.config.auth.cloudDiscoveryMetadata)}var t,r=e.prototype;return r.getAuthCodeUrl=function(e){try{var t=this;return t.logger.info("getAuthCodeUrl called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.AuthorizationCodeClient(r).getAuthCodeUrl(t.initializeRequest(e))}))}catch(e){return Promise.reject(e)}},r.acquireTokenByCode=function(e){try{var t=this;t.logger.info("acquireTokenByCode called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByCode,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.AuthorizationCodeClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenByRefreshToken=function(e){try{var t=this;t.logger.info("acquireTokenByRefreshToken called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByRefreshToken,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.RefreshTokenClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenSilent=function(e){try{var t=this,r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenSilent,r.correlationId,r.forceRefresh);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return new n.SilentFlowClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.getTokenCache=function(){return this.logger.info("getTokenCache called"),this.tokenCache},r.buildOauthClientConfiguration=function(e,t){try{var n=this;n.logger.verbose("buildOauthClientConfiguration called");var r=n.config.auth.clientId;return Promise.resolve(n.createAuthority(e)).then((function(e){return{authOptions:{clientId:r,authority:e,knownAuthorities:n.config.auth.knownAuthorities,cloudDiscoveryMetadata:n.config.auth.cloudDiscoveryMetadata,clientCapabilities:n.config.auth.clientCapabilities},loggerOptions:{loggerCallback:n.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:n.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:n.cryptoProvider,networkInterface:n.config.system.networkClient,storageInterface:n.storage,serverTelemetryManager:t,clientCredentials:{clientSecret:n.clientSecret,clientAssertion:n.clientAssertion?n.getClientAssertion():void 0},libraryInfo:{sku:"msal.js.node",version:"1.0.0-alpha.11",cpu:process.arch||"",os:process.platform||""},persistencePlugin:n.config.cache.cachePlugin,serializableCache:n.tokenCache}}))}catch(e){return Promise.reject(e)}},r.getClientAssertion=function(){return{assertion:this.clientAssertion.getJwt(this.cryptoProvider,this.config.auth.clientId,this._authority.tokenEndpoint),assertionType:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}},r.initializeRequest=function(e){return this.logger.verbose("initializeRequestScopes called"),s({},e,{scopes:[].concat(e&&e.scopes||[],[n.Constants.OPENID_SCOPE,n.Constants.PROFILE_SCOPE,n.Constants.OFFLINE_ACCESS_SCOPE]),correlationId:e&&e.correlationId||this.cryptoProvider.createNewGuid()})},r.initializeServerTelemetryManager=function(e,t,r){return new n.ServerTelemetryManager({clientId:this.config.auth.clientId,correlationId:t,apiId:e,forceRefresh:r||!1},this.storage)},r.createAuthority=function(e){try{var t;return this.logger.verbose("createAuthority called"),e?(this.logger.verbose("Authority passed in, creating authority instance"),t=n.AuthorityFactory.createInstance(e,this.config.system.networkClient)):(this.logger.verbose("No authority passed in request, defaulting to authority set on application object"),t=this.authority),t.discoveryComplete()?Promise.resolve(t):Promise.resolve(l((function(){return Promise.resolve(t.resolveEndpointsAsync()).then((function(){return t}))}),(function(e){throw n.ClientAuthError.createEndpointDiscoveryIncompleteError(e)})))}catch(e){return Promise.reject(e)}},(t=[{key:"authority",get:function(){return this._authority||(this._authority=n.AuthorityFactory.createInstance(this.config.auth.authority||n.Constants.DEFAULT_AUTHORITY,this.config.system.networkClient)),this._authority}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}(),R=function(e){function t(t){return e.call(this,t)||this}return u(t,e),t.prototype.acquireTokenByDeviceCode=function(e){try{var t=this;t.logger.info("acquireTokenByDeviceCode called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByDeviceCode,r.correlationId);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(e){return t.logger.verbose("Auth client config generated"),new n.DeviceCodeClient(e).acquireToken(r)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},t}(M),q=function(){function e(){}e.fromAssertion=function(t){var n=new e;return n.jwt=t,n},e.fromCertificate=function(t,n){var r=new e;return r.privateKey=n,r.thumbprint=t,r};var t=e.prototype;return t.getJwt=function(e,t,r){if(null!=this.privateKey&&null!=this.thumbprint)return null==this.jwt||this.isExpired()||t!=this.issuer||r!=this.jwtAudience?this.createJwt(e,t,r):this.jwt;if(null!=this.jwt)return this.jwt;throw n.ClientAuthError.createInvalidAssertionError()},t.createJwt=function(e,t,r){var i,o;this.issuer=t,this.jwtAudience=r;var a=n.TimeUtils.nowSeconds();this.expirationTime=a+600;var s=((i={}).alg="RS256",i.x5t=k.base64EncodeUrl(this.thumbprint,"hex"),i),u=((o={}).aud=this.jwtAudience,o.exp=this.expirationTime,o.iss=this.issuer,o.sub=this.issuer,o.nbf=a,o.jti=e.createNewGuid(),o);return this.jwt=c.sign(u,this.privateKey,{header:s}),this.jwt},t.isExpired=function(){return this.expirationTime<n.TimeUtils.nowSeconds()},e}(),z=function(e){function t(t){var n;return(n=e.call(this,t)||this).setClientCredential(n.config),n}u(t,e);var r=t.prototype;return r.acquireTokenByClientCredential=function(e){try{var t=this;t.logger.info("acquireTokenByClientCredential called");var r=t.initializeRequest(e),i=t.initializeServerTelemetryManager(f.acquireTokenByClientCredential,r.correlationId,r.skipCache);return Promise.resolve(l((function(){return Promise.resolve(t.buildOauthClientConfiguration(e.authority,i)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.ClientCredentialClient(r).acquireToken(e)}))}),(function(e){throw i.cacheFailedRequest(e),e})))}catch(e){return Promise.reject(e)}},r.acquireTokenOnBehalfOf=function(e){try{var t=this;return t.logger.info("acquireTokenOnBehalfOf called"),Promise.resolve(t.buildOauthClientConfiguration(e.authority)).then((function(r){return t.logger.verbose("Auth client config generated"),new n.OnBehalfOfClient(r).acquireToken(t.initializeRequest(e))}))}catch(e){return Promise.reject(e)}},r.setClientCredential=function(e){var t=!n.StringUtils.isEmpty(e.auth.clientSecret),r=!n.StringUtils.isEmpty(e.auth.clientAssertion),i=e.auth.clientCertificate,o=!n.StringUtils.isEmpty(i.thumbprint)||!n.StringUtils.isEmpty(i.privateKey);if(t&&r||r&&o||t&&o)throw n.ClientAuthError.createInvalidCredentialError();if(t)this.clientSecret=e.auth.clientSecret;else if(r)this.clientAssertion=q.fromAssertion(e.auth.clientAssertion);else{if(!o)throw n.ClientAuthError.createInvalidCredentialError();this.clientAssertion=q.fromCertificate(i.thumbprint,i.privateKey)}},t}(M);Object.defineProperty(exports,"AuthError",{enumerable:!0,get:function(){return n.AuthError}}),Object.defineProperty(exports,"AuthErrorMessage",{enumerable:!0,get:function(){return n.AuthErrorMessage}}),Object.defineProperty(exports,"ClientAuthError",{enumerable:!0,get:function(){return n.ClientAuthError}}),Object.defineProperty(exports,"ClientAuthErrorMessage",{enumerable:!0,get:function(){return n.ClientAuthErrorMessage}}),Object.defineProperty(exports,"ClientConfigurationError",{enumerable:!0,get:function(){return n.ClientConfigurationError}}),Object.defineProperty(exports,"ClientConfigurationErrorMessage",{enumerable:!0,get:function(){return n.ClientConfigurationErrorMessage}}),Object.defineProperty(exports,"InteractionRequiredAuthError",{enumerable:!0,get:function(){return n.InteractionRequiredAuthError}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return n.LogLevel}}),Object.defineProperty(exports,"PromptValue",{enumerable:!0,get:function(){return n.PromptValue}}),Object.defineProperty(exports,"ResponseMode",{enumerable:!0,get:function(){return n.ResponseMode}}),Object.defineProperty(exports,"ServerError",{enumerable:!0,get:function(){return n.ServerError}}),Object.defineProperty(exports,"TokenCacheContext",{enumerable:!0,get:function(){return n.TokenCacheContext}}),exports.ConfidentialClientApplication=z,exports.CryptoProvider=T,exports.PublicClientApplication=R,exports.Storage=O,exports.TokenCache=j,exports.buildAppConfiguration=v; | ||
//# sourceMappingURL=msal-node.cjs.production.min.js.map |
@@ -1346,3 +1346,3 @@ import { LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, TokenCacheContext, AuthorizationCodeClient, RefreshTokenClient, SilentFlowClient, Constants as Constants$1, ServerTelemetryManager, AuthorityFactory, ClientAuthError, Logger, TrustedAuthority, DeviceCodeClient, TimeUtils, ClientCredentialClient, OnBehalfOfClient } from '@azure/msal-common'; | ||
var version = "1.0.0-alpha.10"; | ||
var version = "1.0.0-alpha.11"; | ||
@@ -1349,0 +1349,0 @@ var ClientApplication = /*#__PURE__*/function () { |
{ | ||
"name": "@azure/msal-node", | ||
"version": "1.0.0-alpha.10", | ||
"version": "1.0.0-alpha.11", | ||
"author": { | ||
@@ -74,3 +74,3 @@ "name": "Microsoft", | ||
"dependencies": { | ||
"@azure/msal-common": "^1.6.0", | ||
"@azure/msal-common": "^1.6.1", | ||
"axios": "^0.19.2", | ||
@@ -77,0 +77,0 @@ "debug": "^4.1.1", |
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
585082
4364
Updated@azure/msal-common@^1.6.1